Skip to content

Instantly share code, notes, and snippets.

@ZeronSix
Created October 20, 2015 11:02
Show Gist options
  • Save ZeronSix/4ec4bd978461a0720937 to your computer and use it in GitHub Desktop.
Save ZeronSix/4ec4bd978461a0720937 to your computer and use it in GitHub Desktop.
1654. Шифровка
s = input()
ls = len(s)
stack = [s[0]]
i = 1
while i < ls:
if len(stack) > 0:
ch = stack.pop()
if ch != s[i]:
stack.append(ch)
stack.append(s[i])
else:
stack.append(s[i])
i += 1
print("".join(stack))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment