Skip to content

Instantly share code, notes, and snippets.

@HyeonWooKim
Last active February 28, 2016 13:20
Show Gist options
  • Save HyeonWooKim/11f5a755b491529b52ae to your computer and use it in GitHub Desktop.
Save HyeonWooKim/11f5a755b491529b52ae to your computer and use it in GitHub Desktop.
에디터 Python 버전(BOJ 1406)
s=input()
lst=list(s);rst=[]
k = int(input())
for i in range(0,k):
cmd = input()
if cmd=='L' and len(lst):
rst.append(lst.pop())
elif cmd=='D' and len(rst):
lst.append(rst.pop())
elif cmd=='B' and len(lst):
lst.pop()
else:
cmd=cmd.split()
if(len(cmd)==2):
lst.append(cmd[1])
ret = ''.join(lst)
for v in rst[::-1]:
ret+=v
print(ret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment