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: Runtime Error

Solution code:
# coding: utf-8

def contain_the(char):
	for i in range(len(char)):
		try:
			if char[i] == 't' and char[i+1] == 'h' and (char[i+2] == 'e' or (char[i+2] == 'i' and char[i+3] == 's') or (char[i+2] == 'a' and char[i+3] == 't')):
				return 1
		except IndexError:
			return 0

while True:
	try:
		data = raw_input()
		delta = 1
		while True:
			char = ""
			for i in range(len(data)):
				if data[i] != '.' and data[i] != ' ':
					char += chr(ord(data[i]) - delta)
				else:
					char += data[i]
			if (contain_the(char) == 1):
				print(char)
				break
			else:
				delta += 1
	except EOFError:
		break

Submission status: Runtime Error

Solution code:
# coding: utf-8

def contain_the(char):
	for i in range(len(char)):
		try:
			if char[i] == 't' and char[i+1] == 'h' and (char[i+2] == 'e' or (char[i+2] == 'i' and char[i+3] == 's') or (char[i+2] == 'a' and char[i+3] == 't')):
				return 1
		except IndexError:
			return 0

while True:
	try:
		data = raw_input()
		delta = 1
		while True:
			char = ""
			for i in range(len(data)):
				if data[i] != '.' and data[i] != ' ':
					char += chr(ord(data[i]) - delta)
				else:
					char += data[i]
			if (contain_the(char) == 1):
				print(char)
				break
			else:
				delta += 1
			print("*")
	except EOFError: #なぜかEOFErrorにならない
		print("**")
		break

Submission status: Runtime Error

Solution code:
# coding: utf-8

def contain_the(char):
	for i in range(len(char)):
		try:
			if char[i] == 't' and char[i+1] == 'h' and (char[i+2] == 'e' or (char[i+2] == 'i' and char[i+3] == 's') or (char[i+2] == 'a' and char[i+3] == 't')):
				return 1
		except IndexError:
			return 0

while True:
	try:
		data = raw_input()
		delta = 1
		while True:
			char = ""
			for i in range(len(data)):
				if data[i] != '.' and data[i] != ' ':
					char += chr(ord(data[i]) - delta)
				else:
					char += data[i]
			if (contain_the(char) == 1):
				print(char)
				break
			else:
				delta += 1
			print("*")
	except EOFError:
		print("**")
		break

Submission status: Runtime Error

Solution code:
import sys
def l(s,n):
    o=ord(s)+n
    if not 97<=ord(s)<=122:
        return s
    if 97<=o<=122:
        return chr(o)
    elif o>123:
        return chr(o-26)

for t in sys.stdin:
    s=t[:-1]
    for i in range(1,26):
        e=lambda s:l(s,i)
        if "".join(map(e,"this")) in s:
            break
        if "".join(map(e,"that")) in s:
            break
        if "".join(map(e,"the")) in s:
            break
    print("".join(map(lambda x:l(x,-i),s)))

Submission status: Runtime Error

Solution code:
import sys
def l(s,n):
    o=ord(s)+n
    if not 97<=ord(s)<=122:
        return s
    if 97<=o<=122:
        return chr(o)
    elif o>123:
        return chr(o-26)

for t in sys.stdin:
    s=t[:-1]
    for i in range(1,26):
        e=lambda s:l(s,i)
        if "".join(map(e,"this")) in s:
            break
        if "".join(map(e,"that")) in s:
            break
        if "".join(map(e,"the")) in s:
            break
    print("".join(map(lambda x:l(x,-i),s)))

Submission status: Runtime Error

Solution code:
import sys
def l(s,n):
    o=ord(s.lower())
    if not 97<=o<=122:
        return s
    if 97<=o+n<=122:
        if 97<=ord(s)<=122:
            return chr(o+n)
        else:
            return chr(o+n).upper()
    elif o+n>122:
        if 97<=ord(s)<=122:
            return chr(o+n-26)
        else:
            return chr(o+n-26).upper()

for t in sys.stdin:
    s=t[:-1]
    for i in range(0,26):
        cv=lambda y:"".join(map(lambda x:l(x,i),y))
        if cv("this") in s or cv("that") in s or cv("the") in s:
            break
    print("".join(map(lambda x:l(x,-i),s)))

Submission status: Runtime Error

Solution code:
import sys
def l(s,n):
    o=ord(s.lower())
    if not 97<=o<=122:
        return s
    if 97<=o+n<=122:
        if 97<=ord(s)<=122:
            return chr(o+n)
        else:
            return chr(o+n).upper()
    elif o+n>122:
        if 97<=ord(s)<=122:
            return chr(o+n-26)
        else:
            return chr(o+n-26).upper()

for t in sys.stdin:
    s=t[:-1]
    u=s.lower()
    for i in range(0,26):
        cv=lambda y:"".join(map(lambda x:l(x,i),y))
        if cv("this") in u or cv("that") in u or cv("the") in u:
            break
    print("".join(map(lambda x:l(x,-i),s)))

Submission status: Runtime Error

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:
	
	cipher = raw_input()
	if len(cipher) != 0:
		numcipher = [alp_num[val] for val in cipher]
		while True:
			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: 
				numcipher2 = []
				for val in numcipher:
					if val == ' ': numcipher2.append(' ')
					elif val == '.': numcipher2.append('.')
					elif val == 25: numcipher2.append(0)
					else: numcipher2.append(val+1)
				numcipher = numcipher2
				continue
	else: break

Submission status: Runtime Error

Solution code:
a = raw_input().split()
b = [i for i in a if len(i)==3 or len(i)==4]
c = [i for i in b if ord(i[0])-ord(i[1]) == 12]
s = [ord('t')-ord(c[0][0]),1] if c[0][0]<'t' else [ord(c[0][0])-ord('t'),0]
q=''
for g,i in enumerate(a):
    if g==0:pass
    else: q+=' '
    for j in i:
        if j=='.':
            q+='.'
        elif s[1] == 0:
            q+=chr(ord(j)-s[0])
        elif s[0] == 1:
            q+=chr(ord(j)+s[0])
print q

Submission status: Runtime Error

Solution code:
while True:
    try:
        a = raw_input().split()
        b = [i for i in a if len(i)==3 or len(i)==4]
        c = [i for i in b if ord(i[0])-ord(i[1]) == 12]
        s = [ord('t')-ord(c[0][0]),1] if c[0][0]<'t' else [ord(c[0][0])-ord('t'),0]
        q=''
        for g,i in enumerate(a):
            if g==0:pass
            else: q+=' '
            for j in i:
                if j=='.':
                    q+='.'
                elif s[1] == 0:
                    q+=chr(ord(j)-s[0])
                elif s[0] == 1:
                    q+=chr(ord(j)+s[0])
        print q
    except EOFError:
        break

Submission status: Runtime Error

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()
while True:
    try:
        s = raw_input()
    except:
        break

    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: Runtime Error

Solution code:
# coding: utf-8

#Q003 Largest prime factor

#import math#,sys,time
#import numpy as np
   
#start_time = time.clock()


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()
while True:
    try:
        s = raw_input()
    except:
        break

    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)
        
#print time.clock() - start_time, "seconds"

Submission status: Runtime Error

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()
while True:
    try:
        s = raw_input().strip('\n')
    except:
        break

    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: Runtime Error

Solution code:
import sys
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()
while True:
    try:
        s = raw_input().strip('\n')
    except:
        break

    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: Runtime Error

Solution code:
def rot(s):
    x=""
    for c in s:
        tmp = ord(c)-ord("a")
        if "a"<=c<="z":
            x += chr((tmp+1) % 26 + ord("a"))
        else:
            x += c
    return x
    
def check(s):
    for word in s.split():
        if word=="the" or word=="this" or word=="that":
            return True
    else return False

while True:
    try:
        s = raw_input()
        f = False
        for i in range(26):
            if check(s):break
            else: s=rot(s)
        print s
    except:
        break

Submission status: Runtime Error

Solution code:
b = ["the", "this", "that"]
while 1:
        try:
                a = raw_input()
        except IndexError:
                break
        for y in range(26):
                for x in b:
                        if x in a:
                                print a
                                break
                a = list(a)
                print 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: Runtime Error

Solution code:
b = ["the", "this", "that"]
while 1:
        try:
                a = raw_input()
        except IndexError:
                break
        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: Runtime Error

Solution code:
b = ["the", "this", "that"]
while 1:
        a = raw_input()
        if a == "":
                break
        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: Runtime Error

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:
        sent = ""
        word = map(str, raw_input().split())
        for i in range(len(word))
            for j in range(len(word[i])
                for al in alpha:
                    if al == word[i]:
                        word[i] = al
            sent += word + " "
        sent = sent(:lent(sent)-1)
        print sent
    except:
        break

Submission status: Runtime Error

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():
  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: Runtime Error

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 xrange(ord("z")-ord("a")+1):
        if "the" in s or "that" in s or "this" in s:
            print s[:-1]
            break
      s=decode(s)

Submission status: Runtime Error

Solution code:
import sys
A="abcdefghijklmnopqrstuvwxyza"
def decode(s):
    x=""
    for c in s:
        if c in " .": x+=c
        else: x+=A[A.index(c)+1)
    return x

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: Runtime Error

Solution code:
import sys
A="abcdefghijklmnopqrstuvwxyza"
def decode(s):
    x=""
    for c in s:
        if c in " .": x+=c
        else: x+=A[A.index(c)+1]
    return x

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: Runtime Error

Solution code:
alpha = list('abcdefghijklmnopqrstuvwxyz') * 2

def create_caesar(word, num):
	new_word = ""
	for s in word:
		new_word += alpha[alpha.index(s) + num]
	return new_word

check_the = [create_caesar('the', i) for i in range(26)]
check_this = [create_caesar('this', i) for i in range(26)]
check_that = [create_caesar('that', i) for i in range(26)]
set_the = set(check_the)
set_this = set(check_this)
set_that = set(check_that)

while True:
	sentence = raw_input().split()
	sentence[-1] = sentence[-1].replace('.', '')
	ans = []
	set_sentence = set(sentence)
	if len(set_sentence & set_the)!= 0:
		num = check_the.index(list(set_sentence & set_the)[0])
	elif len(set_sentence & set_this)!= 0:
		num = check_this.index(list(set_sentence & set_this)[0])
	elif len(set_sentence & set_that)!= 0:
		num = check_that.index(list(set_sentence & set_that)[0])

	for s in sentence:
		ans.append(create_caesar(s, -num))

	print " ".join(ans) + "."

Submission status: Runtime Error

Solution code:
alpha = list('abcdefghijklmnopqrstuvwxyz') * 2

def create_caesar(word, num):
	new_word = ""
	if num < 0: num = 26 + num
	for s in word:
		new_word += alpha[alpha.index(s) + num]
	return new_word

check_the = [create_caesar('the', i) for i in range(26)]
check_this = [create_caesar('this', i) for i in range(26)]
check_that = [create_caesar('that', i) for i in range(26)]
set_the = set(check_the)
set_this = set(check_this)
set_that = set(check_that)

while True:
	sentence = raw_input().split()
	sentence[-1] = sentence[-1].replace('.', '')
	ans = []
	set_sentence = set(sentence)
	if len(set_sentence & set_the)!= 0:
		num = check_the.index(list(set_sentence & set_the)[0])
		tmp = check_the[num]
	elif len(set_sentence & set_this)!= 0:
		num = check_this.index(list(set_sentence & set_this)[0])
	elif len(set_sentence & set_that)!= 0:
		num = check_that.index(list(set_sentence & set_that)[0])

	for s in sentence:
		ans.append(create_caesar(s, -num))

	print " ".join(ans) + "."

Submission status: Runtime Error

Solution code:
import string, sys

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

for line in sys.stdin
    while 1:
        if line.count("the") or line.count("this") or line.count("that"):
            print line
            break
        line = text.translate(rot1)

Submission status: Runtime Error

Solution code:
import sys,string

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

for line in sys.stdin:
    while 1:
        if line.count("the") or line.count("this") or line.count("that"):
            print line
            break
        line = text.translate(rot1)

Submission status: Runtime Error

Solution code:
def main():

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

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

    if __debug__:
        print(caesar_chipher_text)

    for i in range(26):
        after_text = []
        flag = False
        if __debug__:
            print('['+ str(i) + ']', end='')

        print('--------------for word in caesar_chipher_text: ---------------')

        for word in caesar_chipher_text:
            if __debug__:
                print(i)
                print('word: ' + word)

            after_word = []

            for char in word:
                if __debug__:
                    print(ord(char))

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

            after_text.append(after_word)

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

            if __debug__:
                print(after_word)

        if __debug__:
            print('dubug:', end='')
            print(after_text)


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

            print(' '.join(anser))
            break


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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, 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: Runtime Error

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: WA: Presentation Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys

def move(i,string):
  lis = []
  for e in string:
    if e == "." :
      lis.append(".")
    elif e == "\n":
      lis.append("\n")
    else:
      if ord(e)+i > 122:
        lis.append( chr(ord(e)+i-26) )
      else:
        lis.append( chr(ord(e)+i ) )
  st = "".join(lis)
  if st in ["the","that","this"]:
    return True
  else:
    return False

def move2(i,string):
  lis = []
  for e in string:
    if e == "." :
      lis.append(".")
    elif e == "\n":
      lis.append("\n")
    elif e == " ":
      lis.append(" ")
    else:
      if ord(e)+i > 122:
        lis.append( chr(ord(e)+i-26) )
      else:
        lis.append( chr(ord(e)+i ) )
  st = "".join(lis)
  return st

for s in sys.stdin:
  flag = False
  i = 0
  d = map(str , s.split())
  for i in range(26):
    for e in d:
      if move(i,e):
        flag = True
        break
    if flag:
      break
  print move2(i,s)

Submission status: WA: Presentation Error

Solution code:
import sys

def c1(c):
    alph ="abcdefghijklmnopqrstuvwxyz"
    if c in alph:
        return alph[(alph.find(c)+1)%26]
    else:
        return c

for string in sys.stdin:
    while True:
        af_string=""
        for c in string:
            af_string+=c1(c)
        if af_string.find("the")!=-1\
           or af_string.find("this")!=-1\
           or af_string.find("that")!=-1:
            break
        string = af_string
    print af_string

Submission status: WA: Presentation Error

Solution code:
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

for s in sys.stdin:
    for i in range(26):
        state = list(s)
        j = 0
        for d in state:
            if 'a' <= d and d <= 'z':
                state[j] = chr((ord(d) + i - ord('a')) % 26 + ord('a'))
            elif 'A' <= d and d <= 'Z':
                state[j] = chr((ord(d) + i - ord('A')) % 26 + ord('A'))
            j += 1

        state = "".join(state)

        if "the" in state or "this" in state or "that" in state:
            print(state)
            break

Submission status: WA: Presentation Error

Solution code:
import string
import sys

a = string.ascii_lowercase
key = str.maketrans(a, a[1:] + a[:1])

for s in sys.stdin:
    for i in range(1, 27):
        s = s.translate(key)
        if 'the' in s or 'this' in s or 'that' in s:
            break
    print(s)

Submission status: WA: Presentation Error

Solution code:
import sys

s = "abcdefghijklmnopqrstuvwxyz"

for line in sys.stdin:
  while True:
    if ("the" in line) or ("this" in line) or ("that" in line):
      break
    else:
      l = [i for i in line]
      for i in range(len(l)):
        if l[i] in s:
          a = s.index(l[i])
          l[i] = l[i].replace(l[i],s[(a+1)%26])
      line = "".join(l)
  print(line)

Submission status: WA: Presentation Error

Solution code:
import sys
for line in sys.stdin:
    for i in range(26):
        search = ""
        for idx in line:
            if 97 <= ord(idx) <= 122:
                if ord(idx) + i <= 122:
                    search += chr(ord(idx) + i)
                else:
                    search += chr(ord(idx) + i - 26)
            else:
                search += idx
        if 'the' in search or 'this' in search or 'that' in search:
            print(search)
            quit

Submission status: WA: Presentation Error

Solution code:
import sys
for line in sys.stdin:
    for i in range(26):
        search = ""
        for idx in line:
            if 97 <= ord(idx) <= 122:
                if ord(idx) + i <= 122:
                    search += chr(ord(idx) + i)
                else:
                    search += chr(ord(idx) + i - 26)
            else:
                search += idx
        if 'the' in search or 'this' in search or 'that' in search:
            print(search)
    else:
        continue
    break

Submission status: WA: Presentation Error

Solution code:
import sys
import math as mas

li="abcdefghijklmnopqrstuvwxyz"
for t in sys.stdin:
	for i in range(30):
		a=t.translate(str.maketrans(li,li[i:]+li[:i]))
		if 1+a.find("this") or 1+a.find("that") or 1+a.find("the"):
			print(a)
			break
#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Submission status: WA: Presentation Error

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

import sys
import os
from math import sin, cos
import math


alphabet = 'abcdefghijklmnopqrstuvwxyz'


def rotate_char(c, num):
    if c == ' ' or c == '.' or c == '\n':
        return c

    n = ord(c) + num
    if n > 122:
        n -= 26
    return chr(n)

def rotate_string(s, num):
    ret = []
    for c in s:
        new_c = rotate_char(c, num)
        ret.append(new_c)
    return ''.join(ret)

for s in sys.stdin:
    for i in range(26):
        rotated = rotate_string(s, i)
        if 'the' in rotated or 'this' in rotated or 'that' in rotated:
            print(rotated)
            break

Submission status: WA: Presentation Error

Solution code:
import sys, string

thelist = ["the", "this", "that"]

def s(ch, n):
    v = ""
    for c in ch:
        if c in string.ascii_lowercase:
            c = chr((ord(c) - ord("a") + int(n)) % 26 + ord("a"))
        v += c
    return v

for line in sys.stdin:
    k = line.split(" ")
    for i in range(26):
        li = []
        for j in k:
            li.append(s(j, i))
        if set(thelist) & set(li):
            break
    print(" ".join(li))

Submission status: WA: Presentation Error

Solution code:
import sys, string

thelist = ["the", "this", "that"]

def s(ch, n):
    v = ""
    for c in ch:
        if c in string.ascii_lowercase:
            c = chr((ord(c) - ord("a") + int(n)) % 26 + ord("a"))
        v += c
    return v

for line in sys.stdin:
    k = line.split(" ")
    for i in range(26):
        li = []
        for j in k:
            li.append(s(j, i))
        if set(thelist) & set(li):
            break
    print(" ".join(li) + k[-1][-1])

Submission status: WA: Presentation Error

Solution code:
import sys, string

thelist = ["the", "this", "that"]


def s(ch, n):
    v = ""
    for c in ch:
        if c in string.ascii_lowercase:
            c = chr((ord(c) - ord("a") + int(n)) % 26 + ord("a"))
        v += c
    return v

for line in sys.stdin:
    for i in range(26):
        l = ""
        for j in line:
            l += s(j, i)
        if set(thelist) & set(l.split(" ")):
            break
    print("".join(l))

Submission status: WA: Presentation Error

Solution code:
import sys

words = list('abcdefghijklmnopqrstuvwxyz')
for line in sys.stdin:
    txt = ''
    for sft in range(0,len(words)):
        txt = ''.join([words[words.index(c) - len(words) + sft] if c in words else c for c in line])
        if 'the' in txt.split() or 'this' in txt.split() or 'that' in txt.split():
            break
    print(txt)

Submission status: WA: Presentation Error

Solution code:
import sys

def caesarshift(sentence):
    abc = "abcdefghijklmnopqrstuvwxyz"
    bcd = abc[1:] + "a"
    return sentence.translate(str.maketrans(abc, bcd))

for line in sys.stdin:
    sentence = line
    while True:
        if "the" in sentence or "this" in sentence or "that" in sentence:
            break
        sentence = caesarshift(sentence)
    print(sentence)

Submission status: WA: Presentation Error

Solution code:
import sys;

for line in sys.stdin:
	if (line.find('the') != -1) | (line.find('this') != -1) | (line.find('that') != -1):
		print(line);
		continue;
		
	alpha = 'abcdefghijklmnopqrstuvwxyz';
	for i in range(1, 26):
		str = '';
		for j in range(len(line) - 1):
			if ((line[j] == ' ') | (line[j] == '.')):
				str += line[j];
				continue;
			
			index = alpha.find(line[j]);
			str += alpha[(index + i) % 26];
		
		if (str.find('the') != -1) | (str.find('this') != -1) | (str.find('that') != -1):
			print(str);
			break;

Submission status: WA: Presentation Error

Solution code:
import sys
def main():
    ex = ["the", "this", "that"]
    lc = [chr(i) for i in range(97, 97 + 26)]
    #lowwer case

    for line in sys.stdin:
        s = line.split()

        for i in range(len(s)):
            a = s[i]
            cnt = 0
            while a not in ex and cnt < 25:
                a = list(a)
                for j in range(len(a)):
                    if a[j] == "z":
                        a[j] = "a"
                    elif a[j] == ".":
                        pass
                    else:
                        a[j] = lc[lc.index(a[j]) + 1]
                hoge = ""
                for j in a:
                    hoge += j

                a = hoge
                cnt += 1
            if cnt != 25:
                break

        for i in range(len(s)):
            a = list(s[i])
            for j in range(len(a)):
                if a[j] == ".":
                    pass
                else:
                    fuga = lc.index(a[j]) + cnt
                    if fuga > 25:
                        a[j] = lc[fuga - 26]
                    else:
                        a[j] = lc[fuga]
            else:
                hoge = ""
                for k in a:
                    hoge += k
                else:
                    s[i] = hoge

        for i in s:
            print(i, end = " ")
        print()


if __name__ == "__main__":
    main()