from Stack import Stack from Queue import Queue # importa pila y fila inf = list(input('inserte string: ')) ops = {'R': 3, '^': 3, '/': 2, '*': 2, '+': 1, '-': 1, ')': 4} que = Queue() stk = Stack() indx = 0 for item in inf: if item.isnumeric(): que._Push(item) elif item in ops: if ops.get(item) == 4: for i in range(stk._getLen()): que._Push(stk._Pop()) elif stk._getLast() == None: stk._Push(item) else: if ops.get(item) > ops.get(stk._getLast()): stk._Push(item) elif ops.get(item) < ops.get(stk._getLast()): for i in range(stk._getLen()): que._Push(stk._Pop())