Problem:


Caesar Cipher

In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:

this is a pen

is would become:

uijt jt b qfo

Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".

Input

Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.

You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.

The number of datasets is less than or equal to 20.

Output

Print decoded texts in a line.

Sample Input

xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.

Output for the Sample Input

this is the picture that i took in the trip.



Sample input:
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.


Sample output:
this is the picture that i took in the trip.

Submission status: Wrong Answer

Solution code:

import sys
import re


def shift(lis):
    a = lis.pop()
    lis.insert(0, a)
    return lis


class Caesar:
    def __init__(self, n):
        a = list("abcdefghijklmnopqrstuvwxyz")
        b = list("abcdefghijklmnopqrstuvwxyz")
        for i in range(n):
            b = shift(b)
#        self.table = map((lambda x, y: (x, y)), a, b)
        self.table = zip(a, b)

    def lookup(self, c):
        for p in self.table:
            if c == p[0]:
                c = p[1]
                break
        return c

    def decrypt(self, str):
        result = map(self.lookup, str)
        return "".join(result)



#input_file = open(sys.argv[1], "r")
r = re.compile(" ?the ?| ?this ?| ?that ?")

#for line in input_file:
for line in sys.stdin:
    line = line.rstrip("\r\n")
    for n in range(1,26):
        caesar = Caesar(n)
        result = caesar.decrypt(line)
        m = r.findall(result)
        if not len(m) == 0:
#            print m
            break
    print result

Submission status: Wrong Answer

Solution code:

import sys
import re


def shift(lis):
    a = lis.pop()
    lis.insert(0, a)
    return lis


class Caesar:
    def __init__(self, n):
        a = list("abcdefghijklmnopqrstuvwxyz")
        b = list("abcdefghijklmnopqrstuvwxyz")
        for i in range(n):
            b = shift(b)
#        self.table = map((lambda x, y: (x, y)), a, b)
        self.table = zip(a, b)

    def lookup(self, c):
        for p in self.table:
            if c == p[0]:
                c = p[1]
                break
        return c

    def decrypt(self, str):
        result = map(self.lookup, str)
        return "".join(result)



#input_file = open(sys.argv[1], "r")
r = re.compile("the|this|that")

#for line in input_file:
for line in sys.stdin:
    line = line.rstrip("\r\n")
    for n in range(1,26):
        caesar = Caesar(n)
        result = caesar.decrypt(line)
        m = r.findall(result)
        if not len(m) == 0:
#            print m
            break
    print result

Submission status: Wrong Answer

Solution code:
dic=[{} for i in range(26)]
alpha = "abcdefghijklmnopqrstuvwxyz"

def makedic():
    for i in range(26):
        tmp = alpha[i:]+alpha[:i]
        for j in range(26):
            dic[i][alpha[j]]=tmp[j]
    return

def crack(word):
    for i in range(26):
        s=[]
        for c in word:
            s.append(dic[i][c])
        s="".join(s)
        if s=="the" or s=="this" or s=="that":
            return i
    return None

makedic()
s = raw_input()

for e in s.split():
    lene=len(e)
    if lene==3 or lene==4:
        offset = crack(e)
        break
x = []
for c in s:
    if "a"<=c and c<="z": x.append(dic[offset][c])
    else: x.append(c)
print "".join(x)

Submission status: Wrong Answer

Solution code:
s = raw_input().strip()
for i in range(26):
    if "the" in s or "this" in s or "that" in s: break
    x = ""
    for j,c in enumerate(s):
        tmp = ord(c)-ord("a")
        if "a"<=c and c<="z":
            x+= chr((tmp+1) % 26 + ord("a"))
        else:
            x+=c
    s=x
print x

Submission status: Wrong Answer

Solution code:
import sys

for line in iter(sys.stdin.readline, ""):
    s = line.strip()
    for i in range(26):
        if "the" in s or "this" in s or "that" in s: break
        x = ""
        for j,c in enumerate(s):
            tmp = ord(c)-ord("a")
            if "a"<=c and c<="z":
                x+= chr((tmp+1) % 26 + ord("a"))
            else:
                x+=c
        s=x
    print x

Submission status: Wrong Answer

Solution code:
import sys

for line in iter(sys.stdin.readline, ""):
    s = line.strip()
    for i in range(26):
        if "the" in s or "this" in s or "that" in s: break
        x = ""
        for j,c in enumerate(s):
            tmp = ord(c)-ord("a")
            if "a"<=c and c<="z":
                x+= chr((tmp+1) % 26 + ord("a"))
            else:
                x+=c
        s=x
    print x,

Submission status: Wrong Answer

Solution code:
s = raw_input()
for i in range(26):
    r = ''
    for c in s:
        if ord('a') <= ord(c) <= ord('z'):
            n = ord(c) - ord('a')
            n = (n + i) % 26
            r += chr(n + ord('a'))
        else:
            r += c
    if 'the' in r or 'this' in r or 'thats' in r:
        print r
        break

Submission status: Wrong Answer

Solution code:
s = raw_input()
for i in range(26):
    r = ''
    for c in s:
        if ord('a') <= ord(c) <= ord('z'):
            n = ord(c) - ord('a')
            n = (n + i) % 26
            r += chr(n + ord('a'))
        else:
            r += c
    if 'the' in r or 'this' in r or 'that' in r:
        print r
        break

Submission status: Wrong Answer

Solution code:
s = raw_input()
for i in range(26):
    r = ''
    for c in s:
        if c.islower():
            n = ord(c) - ord('a') + i
            n = n % 26
            r += chr(n + ord('a'))
        else:
            r += c
    if 'the' in r or 'this' in r or 'that' in r:
        print r
        break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

import sys

itoa = {
	 1:'a', 2:'b', 3:'c', 4:'d', 5:'e',
	 6:'f', 7:'g', 8:'h', 9:'i',10:'j',
	11:'k',12:'l',13:'m',14:'n',15:'o',
	16:'p',17:'q',18:'r',19:'s',20:'t',
	21:'u',22:'v',23:'w',24:'x',25:'y',
	26:'z'
}

atoi = {
	'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5,
	'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j':10,
	'k':11, 'l':12, 'm':13, 'n':14, 'o':15,
	'p':16, 'q':17, 'r':18, 's':19, 't':20,
	'u':21, 'v':22, 'w':23, 'x':24, 'y':25,
	'z':26
}

def main():
	for crypt in sys.stdin:
		for i in xrange(1, 26):
			decrypt = decryptor(crypt.strip(), i)
			if (decrypt.find('the') != -1
				or decrypt.find('this') != -1
				or decrypt.find('then') != -1):
				print decrypt
				continue


def decryptor(crypt, offset):
	decrypt = ''

	crypt = crypt.lower()

	for c in crypt:
		if (c == ' ' or c == ',' or c == '.'):
			decrypt += c
		else:
			code = atoi[c]
			code -= offset
			if (code <= 0 ):
				code = 26 + code

			decrypt += str(itoa[code])

	return decrypt

main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

import sys

itoa = {
	 1:'a', 2:'b', 3:'c', 4:'d', 5:'e',
	 6:'f', 7:'g', 8:'h', 9:'i',10:'j',
	11:'k',12:'l',13:'m',14:'n',15:'o',
	16:'p',17:'q',18:'r',19:'s',20:'t',
	21:'u',22:'v',23:'w',24:'x',25:'y',
	26:'z'
}

atoi = {
	'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5,
	'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j':10,
	'k':11, 'l':12, 'm':13, 'n':14, 'o':15,
	'p':16, 'q':17, 'r':18, 's':19, 't':20,
	'u':21, 'v':22, 'w':23, 'x':24, 'y':25,
	'z':26
}

def main():
	for crypt in sys.stdin:
		for i in xrange(1, 26):
			decrypt = decryptor(crypt, i)
			if (decrypt.find('the') != -1
				or decrypt.find('this') != -1
				or decrypt.find('then') != -1):
				print decrypt
				continue


def decryptor(crypt, offset):
	decrypt = ''

	crypt = crypt.lower()

	for c in crypt:
		if (c == ' ' or c == ',' or c == '.' or c == "\n"):
			decrypt += c
		else:
			code = atoi[c]
			code -= offset
			if (code <= 0 ):
				code = 26 + code

			decrypt += str(itoa[code])

	return decrypt

main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

import sys

itoa = {
	 1:'a', 2:'b', 3:'c', 4:'d', 5:'e',
	 6:'f', 7:'g', 8:'h', 9:'i',10:'j',
	11:'k',12:'l',13:'m',14:'n',15:'o',
	16:'p',17:'q',18:'r',19:'s',20:'t',
	21:'u',22:'v',23:'w',24:'x',25:'y',
	26:'z'
}

atoi = {
	'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5,
	'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j':10,
	'k':11, 'l':12, 'm':13, 'n':14, 'o':15,
	'p':16, 'q':17, 'r':18, 's':19, 't':20,
	'u':21, 'v':22, 'w':23, 'x':24, 'y':25,
	'z':26
}

def main():
	for crypt in sys.stdin:
		for i in xrange(1, 26):
			decrypt = decryptor(crypt.strip(), i)
			if (decrypt.find('the') != -1
				or decrypt.find('this') != -1
				or decrypt.find('that') != -1):
				print decrypt
				continue


def decryptor(crypt, offset):
	decrypt = ''

	for c in crypt:
		if (c == ' ' or c == ',' or c == '.' or c == "\n"):
			decrypt += c
		else:
			code = atoi[c]
			code -= offset
			if (code <= 0 ):
				code = 26 + code

			decrypt += str(itoa[code])

	return decrypt

main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

import sys

itoa = {
	 1:'a', 2:'b', 3:'c', 4:'d', 5:'e',
	 6:'f', 7:'g', 8:'h', 9:'i',10:'j',
	11:'k',12:'l',13:'m',14:'n',15:'o',
	16:'p',17:'q',18:'r',19:'s',20:'t',
	21:'u',22:'v',23:'w',24:'x',25:'y',
	26:'z'
}

atoi = {
	'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5,
	'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j':10,
	'k':11, 'l':12, 'm':13, 'n':14, 'o':15,
	'p':16, 'q':17, 'r':18, 's':19, 't':20,
	'u':21, 'v':22, 'w':23, 'x':24, 'y':25,
	'z':26
}

def main():
	for crypt in sys.stdin:
		for i in xrange(1, 26):
			decrypt = decryptor(crypt.strip(), i)
			if (decrypt.find('the') != -1
				or decrypt.find('this') != -1
				or decrypt.find('that') != -1):
				print decrypt
				break

def decryptor(crypt, offset):
	decrypt = ''

	for c in crypt:
		if (c == ' ' or c == ',' or c == '.' or c == "\n"):
			decrypt += c
		else:
			code = atoi[c]
			code -= offset
			if (code <= 0 ):
				code = 26 + code

			decrypt += str(itoa[code])

	return decrypt

main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

import sys

itoa = {
	 1:'a', 2:'b', 3:'c', 4:'d', 5:'e',
	 6:'f', 7:'g', 8:'h', 9:'i',10:'j',
	11:'k',12:'l',13:'m',14:'n',15:'o',
	16:'p',17:'q',18:'r',19:'s',20:'t',
	21:'u',22:'v',23:'w',24:'x',25:'y',
	26:'z'
}

atoi = {
	'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5,
	'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j':10,
	'k':11, 'l':12, 'm':13, 'n':14, 'o':15,
	'p':16, 'q':17, 'r':18, 's':19, 't':20,
	'u':21, 'v':22, 'w':23, 'x':24, 'y':25,
	'z':26
}

def main():
	for crypt in sys.stdin:
		for i in xrange(1, 25):
			decrypt = decryptor(crypt.strip(), i)
			if (decrypt.find('the') != -1
				or decrypt.find('this') != -1
				or decrypt.find('that') != -1):
				print decrypt
				break

def decryptor(crypt, offset):
	decrypt = ''

	for c in crypt:
		if (c == ' ' or c == ',' or c == '.' or c == "\n"):
			decrypt += c
		else:
			code = atoi[c]
			code -= offset
			if (code <= 0 ):
				code = 26 + code

			decrypt += str(itoa[code])

	return decrypt

main()

Submission status: Wrong Answer

Solution code:
a = raw_input()
b = ["the", "this", "that"]

for y in range(26):
        for x in b:
                if x in a:
                        A = a

        a = list(a)
        for x in range(len(a)):
                if a[x] == "z":
                        a[x] = "a"
                elif "a" <= a[x] < "z":
                        a[x] = chr(ord(a[x])+1)
        a = "".join(a)

print(A)

Submission status: Wrong Answer

Solution code:
a = raw_input()
b = ["the", "this", "that"]

for y in range(26):
        for x in b:
                if x in a:
                        print a
                        break
        a = list(a)
        for x in range(len(a)):
                if a[x] == "z":
                        a[x] = "a"
                elif "a" <= a[x] < "z":
                        a[x] = chr(ord(a[x])+1)
        a = "".join(a)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
from math import *

lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    # List = map(float, line.strip().split(","))

    s = line.strip()

    for i in xrange(1, 26):
        for idx in xrange( len(s) ):
            n = ord(s[idx])
            if n < 97 or n >= 97+26: continue
            n += - 97 + 1
            n %= 26
            s = s[:idx] + chr(n + 97) + s[idx+1:]
        if "this" in s or "that" in s or "the" in s: break

    print s

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
from math import *

lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    # List = map(float, line.strip().split(","))

    s = line.strip()

    for i in xrange(1, 26+1):
        for idx in xrange( len(s) ):
            n = ord(s[idx])
            if n < 97 or n >= 97+26: continue
            n += - 97 + 1
            n %= 26
            s = s[:idx] + chr(n + 97) + s[idx+1:]
        print s
        if "this" in s or "that" in s or "the" in s: break

    print s

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    # List = map(float, line.strip().split(","))

    s = line.strip()

    for i in xrange(1, 26+1):
        for idx in xrange( len(s) ):
            n = ord(s[idx])
            if n < 97 or n >= 97+26: continue
            n += - 97 + 1
            n %= 26
            s = s[:idx] + chr(n + 97) + s[idx+1:]
        if "this" in s or "that" in s or "the" in s: break

    print s,

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    # List = map(float, line.strip().split(","))

    s = line.strip()

    for i in xrange(1, 26+1):
        for idx in xrange( len(s) ):
            n = ord(s[idx])
            if n < 97 or n >= 97+26: continue
            n += - 97 + 1
            n %= 26
            s = s[:idx] + chr(n + 97) + s[idx+1:]
        if "this" in s or "that" in s: break

    print s,

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    # List = map(float, line.strip().split(","))

    s = line.strip()

    for i in xrange(1, 26+1):
        for idx in xrange( len(s) ):
            n = ord(s[idx])
            if n < 97 or n >= 97+26: continue
            n += - 97 + 1
            n %= 26
            s = s[:idx] + chr(n + 97) + s[idx+1:]
        if "this" in s or "that" in s: break

    print s

Submission status: Wrong Answer

Solution code:
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

while True:
    try:
        raw_word = raw_input()
        for key in range(26):
            word = raw_word
            for i in range(len(word)):
                for al in range(26):
                    if word[i] == alpha[al]:
                        word = word[:i]+alpha[(al+key)%26]+word[i+1:]
                        break
            if word.count("the")>1 or word.count("that")>1 or word.count("this")>1:
                print word
    except:
        break

Submission status: Wrong Answer

Solution code:
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
sign = [" ", ".", "," ,":"]

while True:
    try:
        word = raw_input()
        word.lower()
        for key in range(26):
            for i in range(len(word)):
                if not word[i] in sign:
                    ref = alpha.index(word[i])
                    word = word[:i]+alpha[(ref+1)%26]+word[i+1:]
            if word.count("the ")>1 or word.count("that")>1 or word.count("this")>1:
                print word
    except:
        break

Submission status: Wrong Answer

Solution code:
import sys
def rot(s):
  A="abcdefghijklmnopqrstuvwxyza"
  x=""
  for c in s:
    try:x+=A[A.index(c)+1]
    except:x+=c
  return x
w=["the","that","this"]
for s in sys.stdin:
  c=0
  f=1
  while f:
    for i in range(3):
      if w[i] in s:
        f=0
        break
      else:w[i]=rot(w[i])
    else:c+=1
  while c-26:
    s=rot(s)
    c+=1
  print s

Submission status: Wrong Answer

Solution code:
import sys
def rot(s):
  A="abcdefghijklmnopqrstuvwxyza"
  x=""
  for c in s:
    try:x+=A[A.index(c)+1]
    except:x+=c
  return x
w=["the","that","this"]
for s in sys.stdin:
  c=0
  f=1
  while f:
    for i in range(3):
      if w[i] in s:
        f=0
        break
      else:w[i]=rot(w[i])
    else:c+=1
  while c-26:
    s=rot(s)
    c+=1
  print s[:-1]

Submission status: Wrong Answer

Solution code:
import sys
def rot(s):
  A="abcdefghijklmnopqrstuvwxyza"
  x=""
  for c in s:
    try:x+=A[A.index(c)+1]
    except:x+=c
  return x
w=["the","that","this"]
for s in sys.stdin.readlines():
  c=0
  f=1
  while f:
    for i in range(3):
      if w[i] in s:
        f=0
        break
      else:w[i]=rot(w[i])
    else:c+=1
  while c-26:
    s=rot(s)
    c+=1
  print s[:-1]

Submission status: Wrong Answer

Solution code:
import sys
def rot(s):
  A="abcdefghijklmnopqrstuvwxyza"
  x=""
  for c in s:
    try:x+=A[A.index(c)+1]
    except:x+=c
  return x
w=["the","that","this"]
for l in sys.stdin.readlines():
  s=l.strip()
  c=0
  f=1
  while f:
    for i in range(3):
      if w[i] in s:
        f=0
        break
      else:w[i]=rot(w[i])
    else:c+=1
  while c-26:
    s=rot(s)
    c+=1
  print s

Submission status: Wrong Answer

Solution code:
import sys
def decode(s):
    x=""
    for c in s:
        if c in " .": x+=c
        else: x+=chr(ord(c)+1)
    return x.replace(chr(ord("z")+1),"a")

for s in sys.stdin.readlines():
    for i in range(26):
        if "the" in s or "that" in s or "this" in s:break
        s=decode(s)
print s[:-1]

Submission status: Wrong Answer

Solution code:
import sys

input_words = []
while True:
    try:
        input_words = raw_input().split()
        assume_list = [list(str) for str in input_words if len(str) == 4 or len(str) == 3]
        for word in assume_list:
            shift = ord('t') - ord(word[0])
            word = ''.join([chr(ord(c) + shift) for c in word if c.isalpha()])
            if word in ["this", "that", "the"]:
                break
        else:
            print "unknown crypt"
            sys.exit()
        decrypt_list = [list(str) for str in input_words]
        for i in range(len(decrypt_list)):
            for j in range(len(decrypt_list[i])):
                if decrypt_list[i][j].isalpha():
                    decrypt_list[i][j] = chr(ord(decrypt_list[i][j]) + shift)
            decrypt_list[i] = ''.join([c for c in decrypt_list[i]])
            #decrypt_list[i] = ''.join([chr(ord(c) + shift) for c in decrypt_list[i] if c.isalpha()])
        decrypt_list = ' '.join(decrypt_list)
        print decrypt_list
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import sys

input_words = []
while True:
    try:
        input_words = raw_input().split()
        assume_list = [list(str) for str in input_words if len(str) == 4 or len(str) == 3]
        for word in assume_list:
            shift = ord('t') - ord(word[0])
            word = ''.join([chr(ord(c) + shift) for c in word if c.isalpha()])
            if word in ["this", "that", "the"]:
                break
        else:
            print "unknown crypt"
            sys.exit()
        decrypt_list = [list(str) for str in input_words]
        for i in range(len(decrypt_list)):
            for j in range(len(decrypt_list[i])):
                if decrypt_list[i][j].isalpha():
                    c = chr(ord(decrypt_list[i][j]) + shift)
                    if ord(c) > ord('z'):
                        c = chr(ord('a') - ord('z') + ord(c) - 1)
                    decrypt_list[i][j] = c
            decrypt_list[i] = ''.join([c for c in decrypt_list[i]])
        decrypt_list = ' '.join(decrypt_list)
        print decrypt_list
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import sys

input_words = []
while True:
    try:
        input_words = raw_input().split()
        assume_list = [list(str) for str in input_words if len(str) == 4 or len(str) == 3]
        for word in assume_list:
            shift = ord('t') - ord(word[0])
            word = ''.join([chr(ord(c) + shift) for c in word if c.isalpha()])
            if word in ["this", "that", "the"]:
                break
        else:
            print "unknown crypt"
            sys.exit()
        decrypt_list = [list(str) for str in input_words]
        for i in range(len(decrypt_list)):
            for j in range(len(decrypt_list[i])):
                if decrypt_list[i][j].isalpha():
                    c = chr(ord(decrypt_list[i][j]) + shift)
                    if ord(c) > ord('z'):
                        c = chr(ord('a') - ord('z') + ord(c) - 1)
                    elif ord(c) < ord('a'):
                        c = chr(ord('z') + ord('a') - ord(c) - 1)
                    decrypt_list[i][j] = c
            decrypt_list[i] = ''.join([c for c in decrypt_list[i]])
        decrypt_list = ' '.join(decrypt_list)
        print decrypt_list
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import string

rot1 = string.maketrans("abcdefghijklmnopqrstuvwxyz. ",\
                        "bcdefghijklmnopqrstuvwxyza. ")
text = raw_input()

while 1:
    if text.count("the") or text.count("this") or text.count("that"):
        print text
        break
    text = text.translate(rot1)

Submission status: Wrong Answer

Solution code:
def decode(strings, num):
    ret = []
    for string in strings:
        ret.append(''.join([chr(((ord(s) - ord('a')) + num) % 26 + ord('a')) for s in string]))
    return ret

while 1:
    try:
        line = raw_input().strip('.').split()
        print line
        for i in range(26):
            tmp = decode(line, i)
            if 'this' in tmp or 'the' in tmp or 'that' in tmp:
                print ' '.join(tmp) + '.'
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
def decode(strings, num):
    ret = []
    for string in strings:
        ret.append(''.join([chr(((ord(s) - ord('a')) + num) % 26 + ord('a')) for s in string]))
    return ret

while 1:
    try:
        line = raw_input().strip('.').split()
        for i in range(26):
            tmp = decode(line, i)
            if 'the' in tmp or 'this' in tmp or 'that' in tmp:
                print ' '.join(tmp) + '.'
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
def decode(strings, num):
    ret = []
    for string in strings:
        ret.append(''.join([chr(((ord(s) - ord('a')) + num) % 26 + ord('a')) for s in string]))
    return ret

while 1:
    try:
        line = raw_input().strip('.').split()
        for i in range(26):
            tmp = decode(line, i)
            if ('the' in tmp) or ('this' in tmp) or ('that' in tmp):
                print ' '.join(tmp) + '.'
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
def slide_char(char, num):

    if char == '.':
        return char

    if ord('A') <= ord(char) <= ord('Z'):

        if (ord(char) + num) <= ord('Z'):
            return chr(ord(char) + num)

        else:
            return chr(ord('A') + ord(char) + num - ord('Z') - 1)

    else:
        if (ord(char) + num) <= ord('z'):
            return chr(ord(char) + num)

        else:
            return chr(ord('a') + ord(char) + num - ord('z') - 1)


def main():

    check_words = ('the', 'this', 'that')

    caesar_chipher_text = tuple(map(str, raw_input().split()))

    for i in range(26):
        after_text = []
        flag = False

        for word in caesar_chipher_text:

            after_word = []

            for char in word:

                char = slide_char(char, i)
                after_word.append(char)

            after_text.append(after_word)

            if ''.join(after_word) in check_words:
                flag = True


        if flag:
            anser = []
            for text in after_text:
                anser.append(''.join(text))

            print(' '.join(anser))
            break


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a = 'abcdefghijklmnopqrstuvwxyz'
s = input()
for n in range(1, 27):
    t = s.translate(str.maketrans(a, a[n:] + a[:n]))
    if 'the' in t or 'this' in t or 'that' in t: break
print(t)

Submission status: Time Limit Exceeded

Solution code:
s=input()

while True:
    if "this" in s and "that" in s and "the" in s:
        print(s)
        break

    s=list(s)
    for i in range(len(s)):
        if ord(s[i]) <= ord("z") and ord(s[i]) >= ord("a"):
            if s[i] != "z":
                s[i] = chr(ord(s[i])+1)
            else:
                s[i] = "a"
    s="".join(s)

Submission status: Time Limit Exceeded

Solution code:
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i -1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s = s.translate(x)
    if " the " in s or " that " in s or " this " in s:
        print(s)
        break

Submission status: Time Limit Exceeded

Solution code:
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i - 1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s = s.translate(x)
    if " the " in s or "that " in s or "this " in s:
        print(s)
        break

Submission status: Time Limit Exceeded

Solution code:
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i - 1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s = s.translate(x)
    if "the." in s or "that." in s or "this." in s:
        print(s)
        break

Submission status: Time Limit Exceeded

Solution code:
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i -1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s.translate(x)
    if "the" in s or "that" in s or "this" in s:
        print(s)
        break

Submission status: Time Limit Exceeded

Solution code:
alpha = 'abcdefghijklmnopqrstuvwxyz'
alp_num = dict(zip(alpha,range(26)))
num_alp = dict(zip(range(26),alpha))
alp_num[' ']=' ' ; num_alp[' ']=' ' ; alp_num['.']='.' ; num_alp['.']='.'
while True:
	try:
		cipher = raw_input()
		while True:
			numcipher = [alp_num[val] for val in cipher]
			cipher = ''
			for val in numcipher: cipher += str(num_alp[val])
			if 'the'in cipher or 'this'in cipher or 'that'in cipher:
				print cipher ; break
			else: continue
	except: break

Submission status: Time Limit Exceeded

Solution code:
alpha = list('abcdefghijklmnopqrstuvwxyza')

def one_caesar(word):
	new_word = ""
	for s in word:
		if s == ".":
			new_word += "."
			continue
		new_word += alpha[alpha.index(s) + 1]
	return new_word

while True:
	sentence = raw_input().split()
	while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence:
		for i in range(len(sentence)):
			sentence[i] = one_caesar(sentence[i])

	print " ".join(sentence)

Submission status: Time Limit Exceeded

Solution code:
import string

alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])

while True:
	sentence = raw_input()
	while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence:
		sentence = sentence.translate(tbl)

	print sentence

Submission status: Time Limit Exceeded

Solution code:
import string

alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])

while True:
	try:
		sentence = raw_input()
		while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence:
			sentence = sentence.translate(tbl)
		print sentence
	except:
		break

Submission status: Time Limit Exceeded

Solution code:
import string

alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])

while True:
	try:
		sentence = raw_input()
		while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence:
			sentence = sentence.translate(tbl)
		print sentence
	except EOFError:
		break

Submission status: Time Limit Exceeded

Solution code:
import string, sys

alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])

for s in sys.stdin:
	while 'the' not in s or 'that' not in s or 'this' not in s:
		s = s.translate(tbl)
	print s

Submission status: Time Limit Exceeded

Solution code:
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
t = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'than' in s):
    s = s.translate(t)
  print s

Submission status: Time Limit Exceeded

Solution code:
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
t = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'than' in s):
    s = s.translate(t)
  print s[:-1]

Submission status: Time Limit Exceeded

Solution code:
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'than' in s):
    s = s.translate(tbl)
  print s[:-1]

Submission status: Accepted

Solution code:
try:
  while True:
    b = raw_input()
    import string
    t = string.maketrans("abcdefghijklmnopqrstuvwxyz","bcdefghijklmnopqrstuvwxyza")
    while not("this" in b or "the" in b or "that" in b):
        b = b.translate(t)
    print b
except:
    pass

Submission status: Accepted

Solution code:
import sys,string
a = string.ascii_lowercase
t = string.maketrans(a,a[1:]+a[0])
        
for s in sys.stdin:
    s = s.strip()
    while not ('the' in s or 'this' in s or 'that' in s):
        s = s.translate(t)
    print s

Submission status: Accepted

Solution code:
import sys

while True:
    try:
        input = raw_input()
        for i in range(0, 26):
            str = ""
            for c in input:
                if c.isalpha():
                    c = chr(ord(c) + i)
                    if ord(c) > ord('z'):
                        c = chr(ord('a') - ord('z') + ord(c) - 1)
                str += c
            for word in ["this", "that", "the"]:
                if (str.find(word) != -1):
                    print str
                    break
    except EOFError:
        break