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:
x=[i for i in input()]
i=0
y=[0 for i in range(4)]
dif1=0
while(i<len(x)-1):
    s=0
    for j in range(4):
        if (x[j]!=' ')and (x[j]!='.')and (x[j]!='\n'):
            y[j]=x[j]
            s=j
        else:
            s=j
            break       
    if s==3 or s==2:
        dif1=ord(y[0])-ord('t')
        dif2=ord(y[1])-ord('h')
        if dif1==dif2:
            if s==2 and ord(y[2])-dif1==ord('e'):
                break
            else:
                if ord(y[2])-dif1==ord('a') :
                    if y[0]==y[3]:
                        break
                    else:
                        i=i+s+1
                elif ord(y[2])-dif1==ord('i'):
                    if ord(y[3])-dif1==ord('s'):
                        break
                    else:
                        i=i+s+1
                else:
                    i=i+s+1
        else:
            i=i+s+1
            
    else:
        i=i+s+1
for i in range(len(x)):
    if (x[i]!=' ')and (x[i]!='.')and (x[i]!='\n'):
        print(chr(int(ord(x[i]))-dif1),end="")
    else:
        print(x[i],end="")
print(" ",end="")

Submission status: Wrong Answer

Solution code:
x=[i for i in input()]
i=0
y=[0 for i in range(4)]
dif1=0
while(i<len(x)-1):
    s=0
    for j in range(4):
        if (x[i+j]!=' ')and (x[i+j]!='.')and (x[i+j]!='\n'):
            y[j]=x[i+j]
            s=j
        else:
            s=j
            break       
    if s==3 or s==2:
        dif1=ord(y[0])-ord('t')
        dif2=ord(y[1])-ord('h')
        if dif1==dif2:
            if s==2 and ord(y[2])-dif1==ord('e'):
                break
            else:
                if ord(y[2])-dif1==ord('a') :
                    if y[0]==y[3]:
                        break
                    else:
                        i=i+s+1
                elif ord(y[2])-dif1==ord('i'):
                    if ord(y[3])-dif1==ord('s'):
                        break
                    else:
                        i=i+s+1
                else:
                    i=i+s+1
        else:
            i=i+s+1
            
    else:
        i=i+s+1
for i in range(len(x)):
    if (x[i]!=' ')and (x[i]!='.')and (x[i]!='\n'):
        print(chr(int(ord(x[i]))-dif1),end="")
    else:
        print(x[i],end="")

Submission status: Wrong Answer

Solution code:
x=[i for i in input()]
i=0
y=[0 for i in range(4)]
dif1=0
while(i<len(x)-1):
    s=0
    for j in range(4):
        if (x[i+j]!=' ')and (x[i+j]!='.')and (x[i+j]!='\n'):
            y[j]=x[i+j]
        else:
            s=j
            break
    k=i
    while(1):
        if s != 0:
            break
        else:
            if (x[i]==' ') or (x[i]=='.')or (x[i]=='\n'):
                k=i-k
                break
        i=i+1
    if s==3 or s==2:
        dif1=ord(y[0])-ord('t')
        dif2=ord(y[1])-ord('h')
        if dif1==dif2:
            if s==2 and ord(y[2])-dif1==ord('e'):
                break
            else:
                if ord(y[2])-dif1==ord('a') :
                    if y[0]==y[3]:
                        break
                    else:
                        i=i+k+1
                elif ord(y[2])-dif1==ord('i'):
                    if ord(y[3])-dif1==ord('s'):
                        break
                    else:
                        i=i+k+1
                else:
                    i=i+k+1
        else:
            i=i+s+1
            
    else:
        i=i+s+1
for i in range(len(x)):
    if (x[i]!=' ')and (x[i]!='.')and (x[i]!='\n'):
        print(chr(int(ord(x[i]))-dif1),end="")
    else:
        print(x[i],end="")

Submission status: Wrong Answer

Solution code:
while 1:
    try:
        x=[i for i in input()]
        i=0
        y=[0 for i in range(4)]
        dif1=0
        while(i<len(x)-1):
            s=0
            for j in range(4):
                if (x[i+j]!=' ')and (x[i+j]!='.')and (x[i+j]!='\n'):
                    y[j]=x[i+j]
                else:
                    s=j
                    break
            k=i
            while(1):
                if s != 0:
                    break
                else:
                    if (x[i]==' ') or (x[i]=='.')or (x[i]=='\n'):
                        k=i-k
                        break
                i=i+1
            if s==3 or s==2:
                dif1=ord(y[0])-ord('t')
                dif2=ord(y[1])-ord('h')
                if dif1==dif2:
                    if s==2 and ord(y[2])-dif1==ord('e'):
                        break
                    else:
                        if ord(y[2])-dif1==ord('a') :
                            if y[0]==y[3]:
                                break
                            else:
                                i=i+k+1
                        elif ord(y[2])-dif1==ord('i'):
                            if ord(y[3])-dif1==ord('s'):
                                break
                            else:
                                i=i+k+1
                        else:
                            i=i+k+1
                else:
                    i=i+s+1
                    
            else:
                i=i+s+1
        for i in range(len(x)):
            if (x[i]!=' ')and (x[i]!='.')and (x[i]!='\n'):
                print(chr(int(ord(x[i]))-dif1),end="")
            else:
                print(x[i],end="")
                
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
x = [i for i in input()]
s=0
while(s<len(x)):
	k=s
	while(x[k]!='.' and x[k]!='\n'):
		k=k+1
	k=k+1
	n=[ i for i in range(k-s)]
	p=122-ord(x[s])
	m=ord(x[s])-97
	flag=0
	
	for i in range(p+1):
		for j in range(s,k):
			if x[j]==' ' or x[j]=='.':
				n[j-s]=x[j]
			else:
				n[j-s]=chr(ord(x[j])+i)
		moji=''
		for mk in n:
			moji += mk
		if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
			flag=1
			print(moji,end="")
	if flag==0:
		for i in range(m+1):
			for j in range(s,k-1):
				if x[j]==' ' or x[j]=='.':
					n[j-s]=x[j]
				else:
					n[j-s]=chr(ord(x[j])-i)
			moji=''
			for mk in n:
				moji += mk
			if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
				print(moji,end="")
	s=s+k
print("")

Submission status: Wrong Answer

Solution code:
x = [i for i in input()]
s=0
while(s<len(x)):
	k=s
	while(x[k]!='.' and x[k]!='\n'):
		k=k+1
	k=k+1
	n=[ i for i in range(k-s)]
	p=122-ord(x[s])
	m=ord(x[s])-97
	flag=0
	
	for i in range(p+1):
		for j in range(s,k):
			if x[j]==' ' or x[j]=='.':
				n[j-s]=x[j]
			else:
				n[j-s]=chr(ord(x[j])+i)
		moji=''
		for mk in n:
			moji += mk
		if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
			flag=1
			print(moji,end="")
	if flag==0:
		for i in range(m+1):
			for j in range(s,k):
				if x[j]==' ' or x[j]=='.':
					n[j-s]=x[j]
				else:
					n[j-s]=chr(ord(x[j])-i)
			moji=''
			for mk in n:
				moji += mk
			if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
				print(moji,end="")
	s=k
print("")

Submission status: Wrong Answer

Solution code:
while(1):
	try:
		x = [i for i in input()]
		s=0
		while(s<len(x)):
			k=s
			while(x[k]!='.' and x[k]!='\n'):
				k=k+1
			k=k+1
			n=[ i for i in range(k-s)]
			p=122-ord(x[s])
			m=ord(x[s])-97
			flag=0
			
			for i in range(p+1):
				for j in range(s,k):
					if x[j]==' ' or x[j]=='.':
						n[j-s]=x[j]
					else:
						n[j-s]=chr(ord(x[j])+i)
				moji=''
				for mk in n:
					moji += mk
				if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
					flag=1
					print(moji,end="")
			if flag==0:
				for i in range(m+1):
					for j in range(s,k):
						if x[j]==' ' or x[j]=='.':
							n[j-s]=x[j]
						else:
							n[j-s]=chr(ord(x[j])-i)
					moji=''
					for mk in n:
						moji += mk
					if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
						print(moji,end="")
			s=k
		print("")
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while(1):
	try:
		x = [i for i in input()]
		
		n=[ i for i in range(len(x))]
		p=ord('z')-ord(x[0])
		m=ord(x[0])-ord('a')
		flag=0
			
		for i in range(p+1):
			for j in range(len(x)):
				if x[j]==' ' or x[j]=='.' or x[j]=='\n':
					n[j]=x[j]
				else:
					n[j]=chr(ord(x[j])+i)
			moji=''
			for mk in n:
				moji += mk
			if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
				flag=1
				print(moji,end="")
		if flag==0:
			for i in range(1,m+1):
				for j in range(len(x)):
					if x[j]==' ' or x[j]=='.':
						n[j]=x[j]
					else:
						n[j]=chr(ord(x[j])-i)
				moji=''
				for mk in n:
					moji += mk
				if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
					print(moji,end="")
		print("")
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while(True):
	try:
		x = [i for i in input()]
		
		n=[ i for i in range(len(x))]
		p=ord('z')-ord(x[0])
		m=ord(x[0])-ord('a')
		flag=0
			
		for i in range(p+1):
			for j in range(len(x)):
				if x[j]==' ' or x[j]=='.' or x[j]=='\n':
					n[j]=x[j]
				else:
					n[j]=chr(ord(x[j])+i)
			moji=''
			for mk in n:
				moji += mk
			if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
				flag=1
				print(moji,end="")
		if flag==0:
			for i in range(1,m+1):
				for j in range(len(x)):
					if x[j]==' ' or x[j]=='.':
						n[j]=x[j]
					else:
						n[j]=chr(ord(x[j])-i)
				moji=''
				for mk in n:
					moji += mk
				if moji.find('that')!=-1 or moji.find('this')!=-1 or moji.find('the')!=-1 :
					print(moji,end="")
		print("")
	except :
		break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'

for i in range(26):
    decoded_s = ''
    for j in range(len(s)):
        if s[j] not in alphabet:
            decoded_s += s[j]
            continue

        decoded_s += alphabet[alphabet.index(s[j]) - i]

    if 'the' in decoded_s or 'this' in decoded_s or 'that' in decoded_s:
        break

print(decoded_s)

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(26):
    ans = ""
    for j in range(len(s)):
        ch = s[j]
        if "a" <= ch <= "z":
            ans += chr((ord(ch) - ord("a") + i)%26 + ord("a"))
        else:
            ans += ch
    if "this" in ans or "that" in ans or"the" in ans:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(1,27):
    ans = ""
    for j in range(len(s)):
        ch = s[j]
        if "a" <= ch <= "z":
            ans += chr((ord(ch) - ord("a") + i)%26 + ord("a"))
        else:
            ans += ch
    if "this" in ans or "that" in ans or"the" in ans:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(27):
    ans = ""
    for j in range(len(s)):
        ch = s[j]
        if "a" <= ch <= "z":
            ans += chr((ord(ch) - ord("a") + i)%26 + ord("a"))
        else:
            ans += ch
    if "this" in ans or "that" in ans or"the" in ans:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(27):
    ans = ""
    for j in range(len(s)):
        ch = s[j]
        if "a" <= ch <= "z":
            ans += chr((ord(ch) - ord("a") + i)%26 + ord("a"))
        else:
            ans += ch
    if "this" in ans or "that" in ans or"the" in ans:
        print(ans)
        break

Submission status: Wrong Answer

Solution code:
import string
strings = string.ascii_lowercase
clues = [(19, 7, 8, 18), (19, 7, 0, 19), (19, 7, 4)]
while True:
    try:
        data = input()
    except:
        break
    for word in data.split():
        if len(word) == 4 or 3:
            dif = 19 - (ord(word[0]) - 97)
            enc = ["" for _ in range(26)]
            for k, v in zip([i for i in range(dif, dif+26)], strings):
                enc[k%26] = v
            candidate = tuple(enc.index(c) for c in word)
            try:
                clues.index(candidate)
            except:
                continue
            break
    ans = ""
    for c in data:
        try:
            ans += strings[enc.index(c)]
        except:
            ans += " "
    print(ans)

Submission status: Wrong Answer

Solution code:
a='abcdefghijklmnopqrstuvwxy'
b=input()
for i in range(26):
 c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
 if any(('the'in c,'this'in c,'that'in c)):print(c)

Submission status: Wrong Answer

Solution code:
a='abcdefghijklmnopqrstuvwxy'
b=input()
for i in range(26):
 c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
 if any(('the'in c,'this'in c,'that'in c)):print(c);break

Submission status: Wrong Answer

Solution code:
a='abcdefghijklmnopqrstuvwxy'
b=input()
for i in range(26):
 c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
 if any(('the 'in c,'this 'in c,'that 'in c)):print(c);break

Submission status: Wrong Answer

Solution code:
import sys
a='abcdefghijklmnopqrstuvwxy'
for b in sys.stdin:
 b=input()
 for i in range(26):
  c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
  if any(('the'in c,'this'in c,'that'in c)):print(c)

Submission status: Wrong Answer

Solution code:
import sys
a='abcdefghijklmnopqrstuvwxy'
for b in sys.stdin:
 for i in range(26):
  c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
  if any(('the'in c,'this'in c,'that'in c)):print(c)

Submission status: Wrong Answer

Solution code:
import sys
a='abcdefghijklmnopqrstuvwxy'
for b in sys.stdin:
 b=b.strip()
 for i in range(26):
  c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
  if any(('the'in c,'this'in c,'that'in c)):print(c)

Submission status: Wrong Answer

Solution code:
alp=['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']
alp.sort()
def jumper(x):
    if x.isalpha():
        return alp[alp.index(x)-4]
    else:
        return x
x=map(jumper,list(raw_input()))
print ''.join(x)+'\n'

Submission status: Wrong Answer

Solution code:
l = 'abcdefghijklmnopqrstuvwxyz'

while True:
    try:
        s = input()
    except:
        exit()
    for d in range(1,27):
        t = s[:-1].translate(str.maketrans(l,l[d:] + l[:d]))
        if 'that' in t or 'this' in t or 'that' in t:
            print(t + '.')
            break

Submission status: Wrong Answer

Solution code:
def dec(text,d):
    r=[]
    for i in text:
        c=ord(i)
        if c<65:r.append(i)
        elif c<91:r.append(chr((c-65+d)%26+65))
        else:r.append(chr((c-97+d)%26+97))
    return "".join(r)
raw=input()

for i in range(25):
    d=dec(raw,i+1)
    if sum([1 for i in ["the","this","that"] if i in d])>0:break
print(d)

Submission status: Wrong Answer

Solution code:
def dec(text,d):
    r=[]
    for i in text:
        c=ord(i)
        if c<65:r.append(i)
        elif c<91:r.append(chr((c-65+d)%26+65))
        else:r.append(chr((c-97+d)%26+97))
    return "".join(r)

while True:
    try:raw=input()
    except:break
    if raw=="":break
    for i in range(25):
        d=dec(raw,i+1)
        if sum([1 for i in ["the","this","that"] if i in d])>0:break
    print(d)

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

Solution code:
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i - 25] 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: Wrong Answer

Solution code:
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i - 24] 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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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.replace("a", "#")
    for i in range(1, 26):
        s = s.replace(a[i], a[i - 1])
    s = s.replace("#", "z")
#    s = s.translate(x)
    if "the" in s or "that" in s or "this" in s:
        print(s)
        break

Submission status: Wrong Answer

Solution code:
s = input()
a = "abcdefghijklmnopqrstuvwxyz"
i = 1
while True:
    t = s.translate(str.maketrans(a, a[i:] + a[:i]))
    if "the" in t or "that" in t or "this" in t:
        print(t)
        break
    i += 1

Submission status: Wrong Answer

Solution code:
import sys
def rp(char,n):
    p=ord(char)+n
    if 97 <= p-n <= 122:
        if p<=122:
            return chr(p)
        elif p>122:
            return chr(p-122+96)
    else:
        return char

def find(str):
    for j in range(1,26):
        l="".join([rp(i,j) for i in str])
        if "this" in l or "the" in l or "that" in l:
            return l

[print(i) for i in [find(text) for text in sys.stdin] if i]

Submission status: Wrong Answer

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

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: Wrong Answer

Solution code:

dic = ['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']

inp = map(str, raw_input())

out = [ '' for x in range(len(inp))]

for j in range(len(dic)):
    for i in range(len(inp)):
        if inp[i] in dic:
            out[i] = dic[(dic.index(inp[i])+j)%26]
        else:
            out[i] = inp[i]

    for x in range(len(out)-3):    
        if out[x]=='t' and out[x+1]=='h' and out[x+2]=='e' and out[x+3]==' ' or\
           out[x]=='t' and out[x+1]=='h' and out[x+2]=='a' and out[x+3]=='t' or\
           out[x]=='t' and out[x+1]=='h' and out[x+2]=='i' and out[x+3]=='s':
            print ''.join(out)
            break

Submission status: Wrong Answer

Solution code:

dic = ['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']

inp = map(str, raw_input())

out = [ '' for x in range(len(inp))]

for j in range(26):
    for i in range(len(inp)):
        if inp[i] in dic:
            out[i] = dic[(dic.index(inp[i])+j)%26]
        else:
            out[i] = inp[i]

    for x in range(len(out)-4):    
        if out[x]==' ' and out[x+1]=='t' and out[x+2]=='h' and out[x+3]=='e' and out[x+4]==' ':
            print ''.join(out),
            break
        else:
            for y in range(len(out)-5):
                if out[x]==' ' and out[x+1]=='t' and out[x+2]=='h' and out[x+3]=='i' and out[x+4]=='s' and out[x+5]==' ' or\
                   out[x]==' ' and out[x+1]=='t' and out[x+2]=='h' and out[x+3]=='a' and out[x+4]=='t' and out[x+5]==' ':
                    print ''.join(out),
                    break

Submission status: Wrong Answer

Solution code:
dic = ['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']

inp = map(str, raw_input())

out = [ '' for x in range(len(inp))]

for j in range(26):
    for i in range(len(inp)):
        if inp[i] in dic:
            out[i] = dic[(dic.index(inp[i])+j)%26]
        else:
            out[i] = inp[i]



    for x in range(len(out)):
        try:
            if (out[x+1]=='t' and out[x+2]=='h' and out[x+3]=='i' and out[x+4]=='s') and (out[x]not in dic and out[x+5] not in dic)or\
               (out[x+1]=='t' and out[x+2]=='h' and out[x+3]=='a' and out[x+4]=='t') and (out[x]not in dic and out[x+5] not in dic)or\
               (out[x+1]=='t' and out[x+2]=='h' and out[x+3]=='e') and (out[x]not in dic and out[x+4] not in dic) :
                print ''.join(out)
                break
        except IndexError:
            continue

Submission status: Wrong Answer

Solution code:
def transform(s):
    s="".join(map(chr,[i+1 for i in map(ord,s)]))
    return s.replace("{","a")
s=raw_input()
cnt=0
the,this,that="the","this","that"
while True:
    if (the in s) or (this in s) or (that in s):
        break
    else:
        the,this,that=transform(the),transform(this),transform(that)
        cnt+=1

s1=""
for c in s:
    t=c
    for i in range(26-cnt):
        if t.isalpha():
            t=chr(ord(t)+1)
            t=t.replace("{","a")
        else:
            break
    s1+=t
print s1

Submission status: Wrong Answer

Solution code:
def trans(s):
    s1=""
    for c in s:
        if c.isalpha():
            s1+=chr(ord(c)+1)
        else:
            s1+=c
    return s1.replace("{","a")

s=raw_input()
cnt=0
the,this,that="the","this","that"

while True:
    if (the in s) or (this in s) or (that in s):
        print s
        break
    else:
        s=trans(s)

Submission status: Wrong Answer

Solution code:
import sys
def decode(s):
    result=""
    for c in s:
        if not (c==" " or c=="."):
            result+=chr(ord(c)+1)
        else:
            result+=c
    return result.replace(chr(ord("z")+1),"a")
for line in sys.stdin.readlines():
    s=line.strip()
    for i in xrange(ord("z")-ord("a")):
        if "the" in s or "that" in s or "this" in s:
            print s
            break
        s=decode(s)

Submission status: Wrong Answer

Solution code:
def f(x):
    if x.isalpha():
        return chr(((ord(x) - ord("a") - 1) % 26) + ord("a"));
    return x;

while True:
    try:
        print "".join(map(f, raw_input().strip()))
    except:
        break;

Submission status: Wrong Answer

Solution code:
def ces(n):
    def f(x):
        if x.isalpha():
            return chr(((ord(x) - ord("a") - n) % 26) + ord("a"));
        return x;
    return f

while True:
    try:
        inp = raw_input().strip();
        for i in range(1, 26):
            s = "".join(map(ces(i), inp))
            print s, i 
            if (s.find("this") != -1 or s.find("the") != -1 or s.find("that") != -1):
                print s
                break;
    except:
        break;

Submission status: Wrong Answer

Solution code:
def ces(n):
    def f(x):
        if x.isalpha():
            return chr(((ord(x) - ord("a") - n) % 26) + ord("a"));
        return x;
    return f

while True:
    try:
        inp = raw_input().strip();
        for i in range(1, 26):
            s = "".join(map(ces(i), inp))
            if (s.find("this") != -1 or s.find("the") != -1 or s.find("that") != -1):
                print s
                break;
    except:
        break;

Submission status: Wrong Answer

Solution code:
'''
Created on Mar 22, 2013

@author: wukc
'''

from sys import stdin 

def shift(s):
    return ["".join([chr(97+(ord(x)-97+t)%26) if x.islower() else x for x in s]) for t in range(26)]


s=stdin.readline()

for x in zip(*map(shift,s.split())):
    if "this" in x or "the" in x or "that" in x:
        print " ".join(x)

Submission status: Wrong Answer

Solution code:
'''
Created on Mar 22, 2013

@author: wukc
'''

from sys import stdin 

def shift(s):
    return ["".join([chr(97+(ord(x)-97+t)%26) if x.islower() else x for x in s]) for t in range(26)]

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

s=stdin.readline()

for x in shift(s):
    if sum(map(x.count,target))>0:
        print(x)

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:
    for n in range(1,26):
        caesar = Caesar(n)
        result = caesar.decrypt(line)
        m = r.findall(result)
        if 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:
    for n in range(1,26):
        caesar = Caesar(n)
        result = caesar.decrypt(line)
        m = r.findall(result)
        if not len(m) == 0:
            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:
    for n in range(1,26):
        caesar = Caesar(n)
        result = caesar.decrypt(line)
        m = r.findall(result)
        if not len(m) == 0:
            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:
    for n in range(1,26):
        caesar = Caesar(n)
        result = caesar.decrypt(line)
        m = r.findall(result)
        if not len(m) == 0:
            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:
    for n in range(1,26):
        caesar = Caesar(n)
        result = caesar.decrypt(line)
        m = r.findall(result)
        if not len(m) == 0:
            break
    print result