Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Letter Queue by Moff
def letter_queue(commands):
result = []
for row in commands:
cmd = row.split()
if cmd[0] == 'PUSH':
result.append(cmd[1])
elif cmd[0] == 'POP' and result:
result.pop(0)
return ''.join(result)
July 22, 2015