Skip to content

Instantly share code, notes, and snippets.

@wgkoro
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wgkoro/813fda0694d59d7bcf46 to your computer and use it in GitHub Desktop.
Save wgkoro/813fda0694d59d7bcf46 to your computer and use it in GitHub Desktop.
AOJ-0017 Caesar Cipher
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys, string
alphabet = 'abcdefghijklmnopqrstuvwxyza'
table = string.maketrans(alphabet[:-1], alphabet[1:])
for s in sys.stdin:
while not('the' in s or 'this' in s or 'that' in s):
s = s.translate(table)
print s[:-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment