Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Letter Queue by hencoappel
from collections import deque
def letter_queue(commands):
q = deque()
for c in commands:
if c == "POP":
if q:
q.popleft()
else:
q.append(c.split(" ")[1])
return ''.join(q)
Dec. 28, 2014