Last active
February 28, 2016 13:20
-
-
Save HyeonWooKim/11f5a755b491529b52ae to your computer and use it in GitHub Desktop.
에디터 Python 버전(BOJ 1406)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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