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:
from math import *
PI = 3.1415926535898
while True:
	try:
		s = str(raw_input())
		ans = ""
		for x in s:
		 	if x.isalpha():
		 		c = chr(ord(x) - ord('x') + ord('t'))
		 		if ord(c) > ord('z'):
		 			c = chr(ord(c) - 26)
		 		elif ord(c) < ord('a'):
		 			c = chr(ord(c) + 26)
		 		ans += c
		 	else:
		 		ans += x
		print ans
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
strs='abcdefghijklmnopqrstuvwxyz'      #use a string like this, instead of ord()
def shifttext(shift):
    inp=input('')
    data=[]
    for i in inp:                     #iterate over the text not some list
        if i.strip() and i in strs:                 # if the char is not a space ""
            data.append(strs[(strs.index(i) + shift) % 26])
        else:
            data.append(i)           #if space the simply append it to data
    output = ''.join(data)
    return output
print(shifttext(22))

Submission status: Wrong Answer

Solution code:
string='abcdefghijklmnopqrstuvwxyz'
def shifttext(shift,inp):
    s=[]
    for i in inp:
        if i.strip() and i in string:
            s.append(string[(string.index(i) + shift) % 26])
        else:
            s.append(i)
    output = ''.join(s)
    print (output)
inp=input('')
c=[]
words=inp.split()
for word in words:
    if(len(word)==3):
        for i in word:
            print("i is",i)
            if i in string:
                k=string.index(i)-20
                if(k>0):
                    k=26-string.index(i)-1+20
                    shift=((k))
                    break
                elif(k<0):
                    shift=(-1*k)
                else:
                    shift=k
print(shift)
shifttext(shift,inp)

Submission status: Wrong Answer

Solution code:
string='abcdefghijklmnopqrstuvwxyz'
def shifttext(shift,inp):
    s=[]
    for i in inp:
        if i.strip() and i in string:
            s.append(string[(string.index(i) + shift) % 26])
        else:
            s.append(i)
    output = ''.join(s)
    print (output)
inp=input('')
c=[]
words=inp.split()
for word in words:
    if(len(word)==3):
        for i in word:

            if i in string:
                k=string.index(i)-20
                if(k>0):
                    k=26-string.index(i)-1+20
                    shift=((k))
                    break
                elif(k<0):
                    shift=(-1*k)
                else:
                    shift=k
    elif(len(word)==4):
         for i in word:
              if i in string:
                k=string.index(i)-20
                if(k>0):
                    k=26-string.index(i)-1+20
                    shift=((k))
                    break
                elif(k<0):
                    shift=(-1*k)
                else:
                    shift=k

shifttext(shift,inp)

Submission status: Wrong Answer

Solution code:
string='abcdefghijklmnopqrstuvwxyz'
def shifttext(shift,inp):
    s=[]
    for i in inp:
        if i.strip() and i in string:
            s.append(string[(string.index(i) + shift) % 26])
        else:
            s.append(i)
    output = ''.join(s)
    print (output)
inp=input('')
c=[]
words=inp.split()
for word in words:
    if(len(word)==3):
        for i in word:

            if i in string:
                k=string.index(i)-19
                if(k>0):
                    k=26-string.index(i)-1+20
                    shift=((k))
                    break
                elif(k<0):
                    shift=(-1*k)
                else:
                    shift=k
    elif(len(word)==4):
         for i in word:
              if i in string:
                k=string.index(i)-19
                if(k>0):
                    k=26-string.index(i)-1+20
                    shift=((k))
                    break
                elif(k<0):
                    shift=(-1*k)-1
                else:
                    shift=k

shifttext(shift,inp)

Submission status: Wrong Answer

Solution code:
string='abcdefghijklmnopqrstuvwxyz'
def shifttext(shift,inp):
    s=[]
    for i in inp:
        if i.strip() and i in string:
            s.append(string[(string.index(i) + shift) % 26])
        else:
            s.append(i)
    output = ''.join(s)
    print (output)
inp=input('')
c=[]
words=inp.split()
for word in words:
    if(len(word)==3):
        for i in word:
            if i in string:
                k=string.index(i)-19

                if(k>0):
                    k=26-string.index(i)-1+20
                    shift=((k))
                    break
                elif(k<0):
                    shift=(-1*k)
                    break
                else:
                    shift=k
    elif(len(word)==4):
         for i in word:
              if i in string:
                k=string.index(i)-19
                if(k>0):
                    k=26-string.index(i)-1+20
                    shift=((k))
                    break
                elif(k<0):
                    shift=(-1*k)
                    break
                else:
                    shift=k

shifttext(shift,inp)

Submission status: Wrong Answer

Solution code:
import string


def check_exists(word_set, rotate_dict, search):
    for word in word_set:
        rotated_word = ''.join(rotate_dict[s] for s in word)
        if rotated_word == search:
            return True
    return False


s0 = input().strip()
alphabets = string.ascii_lowercase
frequency = sorted([(s0.count(s), 101 - ord(s)) for s in alphabets], reverse=True)
ss = s0.strip('.').split()
sl3, sl4 = set(s for s in ss if len(s) == 3), set(s for s in ss if len(s) == 4)

i, rotate_dict = 0, None
for t in frequency:
    i = t[1]
    rotate_dict = {a: b for a, b in zip(alphabets, alphabets[i:] + alphabets[:i])}
    if (check_exists(sl3, rotate_dict, 'the')
            + check_exists(sl4, rotate_dict, 'this')
            + check_exists(sl4, rotate_dict, 'that')) > 1:
        break

print(''.join(rotate_dict[s] if s.isalpha() else s for s in s0))

Submission status: Wrong Answer

Solution code:
import string


def check_exists(word_set, rotate_dict, search):
    for word in word_set:
        rotated_word = ''.join(rotate_dict[s] for s in word)
        if rotated_word == search:
            return True
    return False


s0 = input().strip()
alphabets = string.ascii_lowercase
frequency = sorted([(s0.count(s), 101 - ord(s)) for s in alphabets], reverse=True)
ss = s0.strip('.').split()
sl3, sl4 = set(s for s in ss if len(s) == 3), set(s for s in ss if len(s) == 4)

i, rotate_dict = 0, None
for t in frequency:
    i = t[1]
    rotate_dict = {a: b for a, b in zip(alphabets, alphabets[i:] + alphabets[:i])}
    if (check_exists(sl3, rotate_dict, 'the')
            + check_exists(sl4, rotate_dict, 'this')
            + check_exists(sl4, rotate_dict, 'that')) > 0:
        break
print(''.join(rotate_dict[s] if s.isalpha() else s for s in s0))

Submission status: Wrong Answer

Solution code:
import string


def check_exists(word_set, rotate_dict, search):
    for word in word_set:
        rotated_word = ''.join(rotate_dict[s] for s in word)
        if rotated_word == search:
            return True
    return False


s0 = input().strip()
alphabets = string.ascii_lowercase
frequency = sorted([(s0.count(s), ord(s)) for s in alphabets], reverse=True)
freq_chr_offset = (4, 0, 19, 8, 14)
ss = s0.strip('.').split()
sl3, sl4 = set(s for s in ss if len(s) == 3), set(s for s in ss if len(s) == 4)

i, rotate_dict = 0, None
for t in frequency:
    for o in freq_chr_offset:
        i = 97 + o - t[1]
        rotate_dict = {a: b for a, b in zip(alphabets, alphabets[i:] + alphabets[:i])}
        if (check_exists(sl3, rotate_dict, 'the')
                + check_exists(sl4, rotate_dict, 'this')
                + check_exists(sl4, rotate_dict, 'that')) > 0:
            break
    else:
        continue
    break

print(''.join(rotate_dict[s] if s.isalpha() else s for s in s0))

Submission status: Wrong Answer

Solution code:
import sys
charlist = ["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"]
lines = []
for line in sys.stdin:
    lines.append(line)
print lines

key = 0
for key in xrange(0,25):
    ansstr = ""
    for line in lines:
        for c in line:
            if c not in charlist:
                ansstr += c
                continue
            pos = charlist.index(c)+key
            if pos > 25:
                pos -= 26
            ansstr += charlist[pos]
    if "this" in ansstr or "the" in ansstr or "this" in ansstr:
        break
print ansstr

Submission status: Wrong Answer

Solution code:
import sys
charlist = ["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"]
lines = []
key = 0
for line in sys.stdin:
    for key in xrange(0,25):
        ansstr = ""
        for c in line:
            if c not in charlist:
                ansstr += c
                continue
            pos = charlist.index(c)+key
            if pos > 25:
                pos -= 26
            ansstr += charlist[pos]
        if "this" in ansstr or "the" in ansstr or "this" in ansstr:
            print ansstr
            break

Submission status: Wrong Answer

Solution code:
import sys
charlist = ["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"]
lines = []
key = 0
for line in sys.stdin:
    line = line.strip()
    for key in xrange(0,25):
        ansstr = ""
        for c in line:
            if c not in charlist:
                ansstr += c
                continue
            pos = charlist.index(c)+key
            if pos > 25:
                pos -= 26
            ansstr += charlist[pos]
        if "this" in ansstr or "the" in ansstr or "this" in ansstr:
            print ansstr
            break

Submission status: Wrong Answer

Solution code:
import sys
charlist = ["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"]
lines = []
key = 0
for line in sys.stdin:
    line = line.strip()
    for key in xrange(0,25):
        ansstr = ""
        for c in line:
            if c not in charlist:
                ansstr += c
                continue
            pos = charlist.index(c)+key
            if pos > 25:
                pos -= 26
            ansstr += charlist[pos]
        if "this" in ansstr or "the" in ansstr or "that" in ansstr:
            print ansstr
            break

Submission status: Wrong Answer

Solution code:
import sys
charlist = ["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"]
lines = []
key = 0
for line in sys.stdin:
    line = line.strip()
    for key in xrange(0,25):
        ansstr = ""
        for c in line:
            if c not in charlist:
                ansstr += c
                continue
            pos = charlist.index(c)+key
            if pos > 25:
                pos -= 26
            ansstr += charlist[pos]
        checkwords = ansstr.split()
        if "this" in checkwords or "the" in checkwords or "that" in checkwords:
            print ansstr
            break

Submission status: Wrong Answer

Solution code:
import sys
charlist = ["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"]
lines = []
key = 0
for line in sys.stdin:
    line = line.strip()
    anslist = []
    for key in xrange(0,25):
        ansstr = ""
        for c in line:
            if c not in charlist:
                ansstr += c
                continue
            pos = charlist.index(c)+key
            if pos > 25:
                pos -= 26
            ansstr += charlist[pos]
        checkwords = ansstr.split()
        # if "this" in checkwords or "the" in checkwords or "that" in checkwords:
        #     print ansstr
        #     break
        if "this" in checkwords or "the" in checkwords or "that" in checkwords:
            anslist.append(ansstr)
    countlist = []
    for ans in anslist:
        count =0
        if "this" in ans:
            count +=1
        if "the" in ans:
            count +=1
        if "that" in ans:
            count +=1
        countlist.append(count)
        print anslist[countlist.index(max(countlist))]

Submission status: Wrong Answer

Solution code:
import sys
charlist = ["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"]
for line in sys.stdin:
    line = line.strip()
    anslist = []
    for key in xrange(0,25):
        ansstr = ""
        for c in line:
            if c not in charlist:
                ansstr += c
                continue
            pos = charlist.index(c)+key
            if pos > 25:
                pos -= 26
            ansstr += charlist[pos]
        checkwords = ansstr.split()
        if "this" in checkwords or "the" in checkwords or "that" in checkwords:
            print ansstr
            break

Submission status: Wrong Answer

Solution code:
t = ord("t")
z = ord("z")
a = ord("a")

def _decode(tv, v):
    spam = ord(v)
    if not (a <= spam <= z):
        return v

    x = t - ord(tv)
    y = spam + x

    if y > z:
        y = a + (y % z)
    elif y < a:
        y = z - (a - y)

    return chr(y)

while 1:
    try:
        txt = input()
        for s in [x for x in txt.split() if len(x) <= 4 and len(x) >= 3]:
            tv = s[0]
            dec_val = ''.join(list(map(lambda x:_decode(tv,x),s)))

            if (dec_val in ('this', 'the', 'that')):
                print(''.join(list(map(lambda x:_decode(tv,x),txt))))
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
t = ord("t")
z = ord("z")
a = ord("a")

def _decode(tv, v):
    spam = ord(v)
    if not (a <= spam <= z):
        return v

    x = t - ord(tv)
    y = spam + x

    if y > z:
        y = a + (y % z)
    elif y < a:
        y = z - (a - y - 1)

    return chr(y)

while 1:
    try:
        txt = input()
        for s in [x for x in txt.split() if 3 <= len(x) <= 4]:
            tv = s[0]
            dec_val = ''.join(list(map(lambda x:_decode(tv,x),s)))

            if (dec_val in ('this', 'the', 'that')):
                print(''.join(list(map(lambda x:_decode(tv,x),txt))))
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
s = input()
b = s
for i in range(1,26):
    c = ''
    for j in b:
        if(j == 'z'):
            c += ('a')
        elif(str.isalpha(j) == 1):
            c += (chr(ord(j) + 1))
        else:
            c += j
    if(('the' in c) | ('this' in c) | ('that' in c)):
        print(c)
        break
    b = ''
    b = c

Submission status: Wrong Answer

Solution code:
b = input()
for i in range(1,26):
    c = ''
    for j in b:
        if(j == 'z'):
            c += ('a')
        elif(str.isalpha(j) == 1):
            c += (chr(ord(j) + 1))
        else:
            c += j
    if(('the ' in c) | ('this ' in c) | ('that ' in c)|
    (' the' in c) | (' this' in c) | (' that' in c)):
        print(c)
        break
    b = c

Submission status: Wrong Answer

Solution code:
import sys
b = sys.stdin
for i in range(1,26):
    c = ''
    for j in b:
        if(j == 'z'):
            c += ('a')
        elif(str.isalpha(j) == 1):
            c += (chr(ord(j) + 1))
        else:
            c += j
    if(('the' in c) | ('this' in c) | ('that' in c)):
        print(c)
        break
    b = c

Submission status: Wrong Answer

Solution code:
import sys
b = sys.stdin
for i in range(1,26):
    c = ''
    for j in b:
        if(j == 'z'):
            c += ('a')
        elif(str.isalpha(j) == 1):
            c += (chr(ord(j) + 1))
        else:
            c += j
    if(('the' in c) | ('this' in c) | ('that' in c)):
        print(c, end = '')
        break
    b = c

Submission status: Wrong Answer

Solution code:
import sys
for b in sys.stdin:
    for i in range(1,26):
        c = ''
        for j in b:
            if(j == 'z'):
                c += ('a')
            elif(str.isalpha(j) == 1):
                c += (chr(ord(j) + 1))
            else:
                c += j
        if 'the' in c or 'this' in c or 'that' in c:
            print(c)
            break
        b = c

Submission status: Wrong Answer

Solution code:
while True:
    try:
        b = input()
    except:
        break
    for i in range(1,26):
        c = ''
        for j in b:
            if(j == 'z'):
                c += ('a')
            elif(str.isalpha(j) == 1):
                c += (chr(ord(j) + 1))
            else:
                c += j
        if 'the' in c or 'this' in c or 'that' in c:
            print(c)
            break
        b = c

Submission status: Wrong Answer

Solution code:
while True:
    try:
        b = input()
    except:
        break
    if 'the' in b or 'this' in b or 'that' in b:
        print(c)
    for i in range(1,26):
        c = ''
        for j in b:
            if(j == 'z'):
                c += ('a')
            elif(str.isalpha(j) == 1):
                c += (chr(ord(j) + 1))
            else:
                c += j
        if 'the' in c or 'this' in c or 'that' in c:
            print(c)
            break
        b = c

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False

A=list(map(str,input().split()))
l=int()
for i in A:
	if len(i)==3:
		if judge_the(i)==True:
			l=ord('t')-ord(i[0])
			break
for i in A:
	for c in i:
		if c=='.':
			print(c,end="")
		else:
			print(chr(ord(c)+l),end="")
	if i!=A[-1]:
		print(end=" ")
	#else:
	#	print()

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False

A=list(map(str,input().split()))
l=int()
for i in A:
	if len(i)==3:
		if judge_the(i)==True:
			l=ord('t')-ord(i[0])
			break
for i in A:
	for c in i:
		if c=='.':
			print(c,end="")
		else:
			print(chr(ord(c)+l),end="")
	if i!=A[-1]:
		print(end=" ")
	else:
		print()

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False
while True:
	try:
		A=list(map(str,input().split()))
		l=int()
		for i in A:
			if len(i)==3:
				if judge_the(i)==True:
					l=ord('t')-ord(i[0])
					break
		for i in A:
			for c in i:
				if c=='.':
					print(c,end="")
				else:
					print(chr(ord(c)+l),end="")
			if i!=A[-1]:
				print(end=" ")
			else:
				print()
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False
while True:
	try:
		A=list(map(str,input().split()))
		l=int()
		for i in A:
			if len(i)==3:
				if judge_the(i)==True:
					l=ord('t')-ord(i[0])
					break
		for i in A:
			for c in i:
				C=ord(c)+l
				if C<0:
					C+=26
				if c=='.':
					print(c,end="")
				else:
					print(chr(ord(c)+l),end="")
			if i!=A[-1]:
				print(end=" ")
			else:
				print()
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False
while True:
	try:
		A=list(map(str,input().split()))
		l=int()
		for i in A:
			if len(i)==3:
				if judge_the(i)==True:
					l=ord('t')-ord(i[0])
					break
		for i in A:
			for c in i:
				C=ord(c)+l
				if C<97:
					C+=26
				if c=='.':
					print(c,end="")
				else:
					print(chr(C),end="")
			if i!=A[-1]:
				print(end=" ")
			else:
				print()
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False

def change(string,l):
	string1=""
	for i in range(len(string)):
		C=ord(string[i])+l
		if C<97:
			C+=26
		elif C>122:
			C-=26
		string1+=chr(C) if string[i]!='.' else '.'
	return string1



while True:
	try:
		A=list(map(str,input().split()))
		l=int()
		for i in A:
			if len(i)==3:
				if judge_the(i)==True:
					l=ord('t')-ord(i[0])
					break
		Ans=[""]*len(A)
		for i in range(len(A)):
			Ans[i]=change(A[i],l)

		print(" ".join(Ans))
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False

def judge_this(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('i')-ord(word[2])==ord('s')-ord(word[3])==length:
		return True
	else:
		return False

def judge_that(woed):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('a')-ord(word[2])==ord('t')-ord(word[3])==length:
		return True
	else:
		return False

def change(string,l):
	string1=""
	for i in range(len(string)):
		C=ord(string[i])+l
		if C<97:
			C+=26
		elif C>122:
			C-=26
		string1+=chr(C) if string[i]!='.' else '.'
	return string1



while True:
	try:
		A=list(map(str,input().split()))
		l=int()
		for i in A:
			if len(i)==3:
				if judge_the(i)==True:
					l=ord('t')-ord(i[0])
					break
			elif len(i)==4:
				if judge_this(i)==True or judge_that(i)==True:
					l=ord('t')-ord(i[0])
					break
		else:
			break#while?????????
		Ans=[""]*len(A)
		for i in range(len(A)):
			Ans[i]=change(A[i],l)

		print(" ".join(Ans))


	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False

def judge_this(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('i')-ord(word[2])==ord('s')-ord(word[3])==length:
		return True
	else:
		return False

def judge_that(woed):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('a')-ord(word[2])==ord('t')-ord(word[3])==length:
		return True
	else:
		return False

def change(string,l):
	string1=""
	for i in range(len(string)):
		C=ord(string[i])+l
		if C<97:
			C+=26
		elif C>122:
			C-=26
		string1+=chr(C) if string[i]!='.' else '.'
	return string1



while True:
	A=list(map(str,input().split()))
	l=int()
	for i in A:
		if len(i)==3:
			if judge_the(i)==True:
				l=ord('e')-ord(i[2])
				break
		elif len(i)==4:
			if judge_this(i)==True :
				l=ord('i')-ord(i[2])
				break
			elif judge_that(i)==True:
				l=ord('a')-ord(i[2])
				break
	else:
		break#while?????????
	Ans=[""]*len(A)
	for i in range(len(A)):
		Ans[i]=change(A[i],l)

	print(" ".join(Ans))

Submission status: Wrong Answer

Solution code:
def judge_the(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('e')-ord(word[2])==length:
		return True
	else:
		return False

def judge_this(word):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('i')-ord(word[2])==ord('s')-ord(word[3])==length:
		return True
	else:
		return False

def judge_that(woed):
	length=ord('t')-ord(word[0])
	if ord('h')-ord(word[1])==ord('a')-ord(word[2])==ord('t')-ord(word[3])==length:
		return True
	else:
		return False

def change(string,l):
	string1=""
	for i in range(len(string)):
		C=ord(string[i])+l
		if C<97:
			C+=26
		elif C>122:
			C-=26
		string1+=chr(C) if string[i]!='.' else '.'
	return string1



while True:
	try:
		A=list(map(str,input().split()))
		l=int()
		for i in A:
			if len(i)==3:
				if judge_the(i)==True:
					l=ord('e')-ord(i[2])
					break
			elif len(i)==4:
				if judge_this(i)==True :
					l=ord('i')-ord(i[2])
					break
				elif judge_that(i)==True:
					l=ord('a')-ord(i[2])
					break
		else:
			break#while?????????
		Ans=[""]*len(A)
		for i in range(len(A)):
			Ans[i]=change(A[i],l)

		print(" ".join(Ans))
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
#encoding=utf-8

ans = ""
def inp():
    split_word = raw_input().split()
    return split_word

def rot(split_word):
    for i in xrange(len(split_word)):
        tako = ""
        if len(split_word[i]) == 4 or len(split_word[i]) == 3:
            num = ord(split_word[i][0]) - ord("t")
            for j in xrange(len(split_word[i])):
                tako +=  chr(ord(split_word[i][j]) - num)
            if tako == "that" or tako == "the" or tako == "this":
                return proce(split_word, num)
        else:
            pass
        num = 0

def proce(split_word, num):
    ans = ""
    for i in xrange(len(split_word)):
        for j in xrange(len(split_word[i])):
            if split_word[i][j] == ".":
                ans += split_word[i][j]
                return ans
            else:
                ans += str(chr(ord(split_word[i][j]) - num))
        ans += " "
    return ans


if __name__ == "__main__":
    word = inp()
    print rot(word)

Submission status: Wrong Answer

Solution code:
#encoding=utf-8

ans = ""
def inp(i):
    split_word = i.split()
    return split_word

def rot(split_word):
    for i in xrange(len(split_word)):
        tako = ""
        if len(split_word[i]) == 4 or len(split_word[i]) == 3:
            num = ord(split_word[i][0]) - ord("t")
            for j in xrange(len(split_word[i])):
                tako +=  chr(ord(split_word[i][j]) - num)
            if tako == "that" or tako == "the" or tako == "this":
                return proce(split_word, num)
        else:
            pass
        num = 0

def proce(split_word, num):
    ans = ""
    for i in xrange(len(split_word)):
        for j in xrange(len(split_word[i])):
            if split_word[i][j] == ".":
                ans += split_word[i][j]
                return ans
            else:
                ans += str(chr(ord(split_word[i][j]) - num))
        ans += " "
    return ans


if __name__ == "__main__":
    import sys
    for i in sys.stdin:
        word = inp(i)
        print rot(word)

Submission status: Wrong Answer

Solution code:
#encoding=utf-8

def inp(i):
    split_word = i.split()
    return split_word

def rot(split_word):
    for i in xrange(len(split_word)):
        tako = ""
        if len(split_word[i]) == 4 or len(split_word[i]) == 3:
            num = ord(split_word[i][0]) - ord("t")
            for j in xrange(len(split_word[i])):
                tako +=  chr(ord(split_word[i][j]) - num)
            if tako == "that" or tako == "the" or tako == "this":
                return proce(split_word, num)
        else:
            pass
        num = 0

def proce(split_word, num):
    ans = ""
    for i in xrange(len(split_word)):
        for j in xrange(len(split_word[i])):
            if split_word[i][j] < ord("a") or ord("z") < split_word[i][j]:
                ans += split_word[i][j]
            else:
                ans += str(chr(ord(split_word[i][j]) - num))
        ans += " "
    return ans


if __name__ == "__main__":
    import sys
    for i in sys.stdin:
        word = inp(i)
        print rot(word)

Submission status: Wrong Answer

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

import sys
import codecs

for line in sys.stdin:
    k = ord(line[0])-ord('t')
    ans = ""
    for i in range(len(line)):
        a = ord(line[i])
        if ord('a') <= a <= ord('z'):
            if a-k >= ord('a'):
                ans = ans + chr(a-k)
            else:
                ans = ans + chr(a-k+26)
        else:
            ans = ans + line[i]
    print ans

Submission status: Wrong Answer

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

import sys
import codecs

for line in sys.stdin:
    for i in range(1, 26):
        ans = ""
        for j in range(len(line)):
            a = ord(line[j])
            if ord('a') <= a <= ord('z'):
                if a-i >= ord('a'):
                    ans = ans + chr(a-i)
                else:
                    ans = ans + chr(a-i+26)
            else:
                ans = ans + line[j]
        print ans
        if "the" in ans or "this" in ans or "that" in ans:
            break
    print ans

Submission status: Wrong Answer

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

import sys
import codecs

for line in sys.stdin:
    for i in range(1, 26):
        ans = ""
        for j in range(len(line)):
            a = ord(line[j])
            if ord('a') <= a <= ord('z'):
                if a-i >= ord('a'):
                    ans = ans + chr(a-i)
                else:
                    ans = ans + chr(a-i+26)
            else:
                ans = ans + line[j]
        if "the" in ans or "this" in ans or "that" in ans:
            break
    sys.stdout.write(ans)

Submission status: Wrong Answer

Solution code:
s = input()[:-1].split()
while True:
    for i in range(26):
        li = []
        for word in s:
            t = ""
            for c in word:
                t += chr( (ord(c) - ord('a') + i) % 26 + ord('a') )
            li.append(t)
        if 'this' in li or 'that' in li or 'the' in li:
            print(" ".join(li) + '.')
            exit()

Submission status: Wrong Answer

Solution code:
s = input()[:-1].split()
D = 0
for word in s:
    if len(word) == 3:
        diff = []
        for c, d in zip(word, 'the'):
            diff.append(ord(c) - ord(d))
        if diff.count(diff[0]) == 3:
            D = diff[0]
            break
    if len(word) == 4:
        diff = []
        for c, d in zip(word, 'that'):
            diff.append(ord(c) - ord(d))
        if diff.count(diff[0]) == 4:
            D = diff[0]
            break
        diff = list([])
        for c, d in zip(word, 'this'):
            diff.append(ord(c) - ord(d))
        if diff.count(diff[0]) == 4:
            D = diff[0]
            break


print(D)
li = []
for word in s:
    t = ""
    for c in word:
        t += chr( (ord(c) - ord('a') + 26 - D) % 26 + ord('a') )
    li.append(t)
print(" ".join(li) + '.')