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:
b = raw_input()
a = b.split()
cnt = 0
for i in a:
    for k in range(-26, 53):
        tmp = ""
        for j in i:
            tmp+=chr(ord(j)+k)
        if tmp == "this" or tmp == "that" or tmp == "the":
            cnt = k
tmp = ""
for i in b:
    if i in "abcdefghijklmnopqrstrvwxyz":
        tmp += chr(ord(i)+cnt)
    else:
        tmp += i
print tmp

Submission status: Wrong Answer

Solution code:
b = raw_input()
a = b.split()
cnt = 0
for i in a:
    for k in range(-26, 26):
        tmp = ""
        for j in i:
            tmp+=chr(ord(j)+k)
        if tmp == "this" or tmp == "that" or tmp == "the":
            cnt = k
tmp = ""
for i in b:
    if i in "abcdefghijklmnopqrstrvwxyz":
        tmp += chr(ord(i)+cnt)
    else:
        tmp += i
print tmp

Submission status: Wrong Answer

Solution code:
b = raw_input()
a = b.split()
cnt = 0
for k in range(-26, 26):
    tmp = ""
    for j in b:
        tmp+=chr(ord(j)+k)
    if "this" in tmp or "that" in tmp or "the" in tmp:
        cnt = k
tmp = ""
for i in b:
    if i in "abcdefghijklmnopqrstrvwxyz":
        tmp += chr(ord(i)+cnt)
    else:
        tmp += i
print tmp

Submission status: Wrong Answer

Solution code:
b = raw_input()
a = b.split()
cnt = 0
for k in range(-26, 26):
    tmp = ""
    for j in b:
        tmp+=chr(ord(j)+k)
    if "this" in tmp or "that" in tmp or "the" in tmp:
        cnt = k
tmp = ""
for i in b:
    if i in "abcdefghijklmnopqrsturvwxyz":
        tmp += chr(ord(i)+cnt)
    else:
        tmp += i
print tmp

Submission status: Wrong Answer

Solution code:
b = raw_input()
a = b.split()
cnt = 0
for k in range(-26, 26):
    tmp = ""
    for j in b:
        tmp+=chr(ord(j)+k)
    if "this" in tmp or "that" in tmp or "the" in tmp:
        cnt = k
tmp = ""
for i in b:
    if i in "abcdefghijklmnopqrstuvwxyz":
        tmp += chr(ord(i)+cnt)
    else:
        tmp += i
print tmp

Submission status: Wrong Answer

Solution code:
b = raw_input().strip()
a = b.split()
cnt = 0
for k in range(-26, 26):
    tmp = ""
    for j in b:
        tmp+=chr(ord(j)+k)
    if "this" in tmp or "that" in tmp or "the" in tmp:
        cnt = k
tmp = ""
for i in b:
    if i in "abcdefghijklmnopqrstuvwxyz":
        tmp += chr(ord(i)+cnt)
    else:
        tmp += i
print tmp

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

Solution code:
import string
import sys

str = input()
alpha = string.ascii_lowercase

for str in sys.stdin:
    for i in range(len(alpha)):
        cipher_str = ""
        for s in str:
            if s in alpha:
                cipher_str += alpha[(alpha.index(s)+i) % len(alpha)]
            else:
                cipher_str += s

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

Submission status: Wrong Answer

Solution code:
import string
import sys

line = input()
alpha = string.ascii_lowercase

for line in sys.stdin:
    for i in range(len(alpha)):
        cipher_str = ""
        for s in line:
            if s in alpha:
                cipher_str += alpha[(alpha.index(s)+i) % len(alpha)]
            else:
                cipher_str += s

        if ("the" or "this" or "that") in cipher_str:
            print(cipher_str)
            break
    else:
        print(line)

Submission status: Wrong Answer

Solution code:
import string
import sys

alpha = string.ascii_lowercase

for line in sys.stdin:
    for i in range(len(alpha)):
        cipher_str = ""
        for s in line:
            if s in alpha:
                cipher_str += alpha[(alpha.index(s)+i) % len(alpha)]
            else:
                cipher_str += s

        if ("the" or "this" or "that") in cipher_str:
            print(cipher_str)
            break
    else:
        print(line)

Submission status: Wrong Answer

Solution code:
import string
import sys

alpha = string.ascii_lowercase

for line in sys.stdin:
    for i in range(len(alpha)):
        cipher_str = ""
        for s in line:
            if s in alpha:
                cipher_str += alpha[(alpha.index(s)+i) % len(alpha)]
            else:
                cipher_str += s

        if ("the" or "this" or "that") in cipher_str:
            print(cipher_str, end="")
            break
    else:
        print(line, end="")

Submission status: Wrong Answer

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

flag = False
s = sys.stdin.read()
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: Wrong Answer

Solution code:
import sys
import string
f = sys.stdin

sentence = ''.join([line for line in f])

ceasar1 = str.maketrans(string.ascii_lowercase, string.ascii_lowercase[1:] + string.ascii_lowercase[:1])
for i in range(len(string.ascii_lowercase)):
    sentence = sentence.translate(ceasar1)
    for word in ['the', 'this', 'that']:
        if sentence.find(word) != -1:
            print(sentence)
            break

Submission status: Wrong Answer

Solution code:
import sys
import string
f = sys.stdin

sentence = ''.join([line for line in f])

ceasar1 = str.maketrans(string.ascii_lowercase, string.ascii_lowercase[1:] + string.ascii_lowercase[:1])
for i in range(len(string.ascii_lowercase)):
    sentence = sentence.translate(ceasar1)
    for word in ['the', 'this', 'that']:
        if sentence.find(word) != -1:
            print(sentence, end='')
            break

Submission status: Wrong Answer

Solution code:
import sys
import string
f = sys.stdin



sentence = ''.join([line for line in f])

ceasar1 = str.maketrans(string.ascii_lowercase, string.ascii_lowercase[1:] + string.ascii_lowercase[:1])
for i in range(len(string.ascii_lowercase)):
    sentence = sentence.translate(ceasar1)
    words = sentence.split()
    for word in ['the', 'this', 'that']:
        if word in words:
            print(sentence, end='')
            break

Submission status: Wrong Answer

Solution code:
def convert_alphabets_to_numlist(word_string):
    temp=[]
    for char in word_string:
        for num in range(26):
            if char==string[num]:
                temp.append(num)
    return temp
    
def plus1_to_num_list(ls):
    "plus 1 each item in ls"
    for n in range(len(ls)):
        if ls[n]!=25:
            ls[n] +=1
        elif ls[n]==25:
            ls[n]=0
    return ls
    
def decipher(word_nums):
    "[19, 7, 4]"
    temp=""
    for k in word_nums:
        temp += string[int(k)]
    return temp

string = 'abcdefghijklmnopqrstuvwxyz'                        
hint=['the','this','that']
hint_num=[[19, 7, 4],[19, 7, 8, 18],[19, 7, 0, 19]]

while True:
    try:
        cryp=raw_input().split()
        for word in cryp:
            word_nums= convert_alphabets_to_numlist(str(word))
            n=0
            while word_nums not in hint_num and n<26:
                plus1_to_num_list(word_nums)
                n+=1    
    
        temp = []
        for word in cryp:
            word_nums=convert_alphabets_to_numlist(str(word))
            for k in range(n):
                plus1_to_num_list(word_nums)
            temp.append(decipher(word_nums))
        if '.' not in cryp[-1]:
            print " ".join(temp)
        else:
            temp[-1] += '.'
            print " ".join(temp)
    except:
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def convert_alphabets_to_numlist(word_string):
    temp=[]
    for char in word_string:
        for num in range(26):
            if char==string[num]:
                temp.append(num)
    return temp
    
def plus1_to_num_list(ls):
    "plus 1 each item in ls"
    for n in range(len(ls)):
        if ls[n]!=25:
            ls[n] +=1
        elif ls[n]==25:
            ls[n]=0
    return ls
    
def decipher(word_nums):
    "[19, 7, 4]"
    temp=""
    for k in word_nums:
        temp += string[int(k)]
    return temp

string = 'abcdefghijklmnopqrstuvwxyz'                        
hint=['the','this','that']
hint_num=[[19, 7, 4],[19, 7, 8, 18],[19, 7, 0, 19]]

while True:
    try:
        cryp=raw_input().split()
        nlist = []
        for word in cryp:
            word_nums= convert_alphabets_to_numlist(str(word))
            
            n=0
            min_n =26
            
            while word_nums not in hint_num and n<=26:
                plus1_to_num_list(word_nums)
                n+=1    
            else:
                nlist.append(n)
        else:
            min_n = min(nlist)
        
        temp = []
        for word in cryp:
            word_nums=convert_alphabets_to_numlist(str(word))
            for k in range(min_n):
                plus1_to_num_list(word_nums)
            temp.append(decipher(word_nums))
        if '.' not in cryp[-1]:
            print " ".join(temp)
        else:
            temp[-1] += '.'
            print " ".join(temp)
    except:
        break

Submission status: Wrong Answer

Solution code:
def convert_alphabets_to_numlist(word_string):
    temp=[]
    for char in word_string:
        for num in range(26):
            if char==string[num]:
                temp.append(num)
    return temp
    
def plus1_to_num_list(ls):
    "plus 1 each item in ls"
    for n in range(len(ls)):
        if ls[n]!=25:
            ls[n] +=1
        elif ls[n]==25:
            ls[n]=0
    return ls
    
def decipher(word_nums):
    "[19, 7, 4]"
    temp=""
    for k in word_nums:
        temp += string[int(k)]
    return temp

string = 'abcdefghijklmnopqrstuvwxyz'                        
hint=['the','this','that']
hint_num=[[19, 7, 4],[19, 7, 8, 18],[19, 7, 0, 19]]

while True:
    try:
        cryp=raw_input().split()
        nlist = []
        for word in cryp:
            word_nums= convert_alphabets_to_numlist(str(word))
            
            n=0
            min_n =26
            
            while word_nums not in hint_num and n<=26:
                plus1_to_num_list(word_nums)
                n+=1    
            else:
                nlist.append(n)
        else:
            min_n = min(nlist)
        
        temp = []
        for word in cryp:
            word_nums=convert_alphabets_to_numlist(str(word))
            for k in range(min_n):
                plus1_to_num_list(word_nums)
            temp.append(decipher(word_nums))
        if '.' not in cryp[-1]:
            print " ".join(temp)
        else:
            temp[-1] += '.'
            print " ".join(temp)
    except:
        break

Submission status: Wrong Answer

Solution code:
import sys

def this(word):
    i=0
    t=[]
    for c in word:
        t.append(ord(c)-ord('this'[i]))
        i+=1
    if(t[0]==t[1] and t[1]==t[2] and t[2]==t[3]):
        return t[0]
    return 30

def that(word):
    i=0
    t=[]
    for c in word:
        t.append(ord(c)-ord("that"[i]))
        i+=1
    if(t[0]==t[1] and t[1]==t[2] and t[2]==t[3]):
        return t[0]
    return 30

def the(word):
    i=0
    t=[]
    for c in word:
        t.append(ord(c)-ord("the"[i]))
        i+=1
    if(t[0]==t[1] and t[1]==t[2]):
        return t[0]
    return 30

for string in sys.stdin:
    for word in string.split(" "):
        if(len(word)==3):
           if the(word) < 30:
               x=the(word)
               break
        if(len(word)==4):
           if this(word) <30:
               x=this(word)
               break
           if that(word) <30:
               x=that(word)
               break
    alpha = 'abcdefghijklmnopqrstuvwxyz'
    result=""
    for c in string:
        if c in alpha:
            result+=alpha[alpha.find(c)]
        else:
            result+=c
    print result[:-1]

Submission status: Wrong Answer

Solution code:
s=input()

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

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

Submission status: Wrong Answer

Solution code:
s=input()

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

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

Submission status: Wrong Answer

Solution code:
s=input()

for _ in range(26):
    if "this " in s or "that " in s or "the " in s:
        print(s)
        break

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

Submission status: Wrong Answer

Solution code:
s=input()

for _ in range(26):
    if " this " in s or " that " in s or " the " in s:
        print(s)
        break

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

Submission status: Wrong Answer

Solution code:
s=input()

for _ in range(26):
    if " this." in s or " that." in s or " the." in s:
        print(s)
        break

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

Submission status: Wrong Answer

Solution code:
s=input()

for _ in range(26):
    if " this." in s or " that." in s or " the." in s or " this " in s or " that " in s or " the " in s:
        print(s)
        break

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

Submission status: Wrong Answer

Solution code:

while 1:
	try:
		s = raw_input()
		li = s.split()

		for i in li:
			if len(i) == 4 or len(i) == 3:
				a = ord(i[0]) - ord(i[1])
				b = ord(i[1]) - ord(i[2])
				c = ord(i[2]) - ord(i[3])
		
				if a == 12 and b == -1 and c == -10:
					n = ord(i[0]) - ord("t")
					break
				elif a == 12 and b == 3:
					n = ord(i[0]) - ord("t")
					break
				elif a == 12 and b == 7 and c == -19:
					n = ord(i[0]) - ord("t")
					break

		o = ""
		for c in s:
			if ord(c) >= 97 and ord(c) <= 122:
				o += chr(ord(c) - n)
			else:
				o += c

		print(o)
	except:
		exit()

Submission status: Wrong Answer

Solution code:
import sys

while 1:
	try:
		s = sys.stdin
		li = s.split()

		for i in li:
			if len(i) == 4 or len(i) == 3:
				a = ord(i[0]) - ord(i[1])
				b = ord(i[1]) - ord(i[2])
				c = ord(i[2]) - ord(i[3])
		
				if a == 12 and b == -1 and c == -10:
					n = ord(i[0]) - ord("t")
					break
				elif a == 12 and b == 3:
					n = ord(i[0]) - ord("t")
					break
				elif a == 12 and b == 7 and c == -19:
					n = ord(i[0]) - ord("t")
					break

		o = ""
		for c in s:
			if ord(c) >= 97 and ord(c) <= 122:
				o += chr(ord(c) - n)
			else:
				o += c

		print(o)
	except:
		exit()

Submission status: Wrong Answer

Solution code:
import sys

while 1:
	try:
		s = sys.stdin.read()
		li = s.split()
		n = 0

		for i in li:
			if len(i) == 4 or len(i) == 3:
				a = ord(i[0]) - ord(i[1])
				b = ord(i[1]) - ord(i[2])
				c = ord(i[2]) - ord(i[3])
		
				if a == 12 and b == -1 and c == -10:
					n = ord(i[0]) - ord("t")
					break
				elif a == 12 and b == 3:
					n = ord(i[0]) - ord("t")
					break
				elif a == 12 and b == 7 and c == -19:
					n = ord(i[0]) - ord("t")
					break

		o = ""
		for c in s:
			if ord(c) >= 97 and ord(c) <= 122:
				o += chr(ord(c) - n)
			else:
				o += c

		print(o)
	except:
		exit()

Submission status: Wrong Answer

Solution code:
import string
def cipher(s, i):
    if s in string.ascii_lowercase:
        return string.ascii_lowercase[(ord(s) - ord('a')+ i) % 26]
    elif s in string.ascii_uppercase:
        return string.ascii_uppercase[(ord(s) - ord('A')+ i) % 26]
    else:
        return s

def decode(s, i):
    return ''.join([cipher(x, i) for x in s])

sent = input().split()

for i in range(26):
    si = [decode(s, i) for s in sent]
    if 'the' in si or 'this' in si or 'that' in si:
        print(' '.join(si))
        break

Submission status: Wrong Answer

Solution code:
import sys
def c(w,n):return reduce(lambda a,b:a+b,[chr(ord(x)+n) if x.isalpha() else x for x in w])
for i in sys.stdin:
	n=0
	for s in i.replace(".","").split():
		r=c(s,116-ord(s[0]))
		m=len(s)
		if m==3 and"the"==r or m==4 and("this"==r or"that"==r):
			n=116-ord(s[0])
	print c(i,n),

Submission status: Wrong Answer

Solution code:
import sys
def c(w,n):return reduce(lambda a,b:a+b,[chr(ord(x)+n) if x.isalpha() else x for x in w])
for i in sys.stdin:
	n=0
	for s in i.replace(".","").split():
		r=c(s,116-ord(s[0]))
		m=len(s)
		if m==3 and"the"==r or m==4 and("this"==r or"that"==r):
			n=116-ord(s[0])
	print c(i,n)

Submission status: Wrong Answer

Solution code:
import sys
def c(w,n):return reduce(lambda a,b:a+b,[chr(ord(x)+n) if x.isalpha() else x for x in w])
for i in sys.stdin:
	n=0
	for s in i.replace(".","").split():
		r=c(s,116-ord(s[0]))
		m=len(s)
		if m==3 and"the"==r or m==4 and("this"==r or"that"==r):
			n=116-ord(s[0])
	print c(i,n).replace("\n","")

Submission status: Wrong Answer

Solution code:
import sys

def check1():
    for string in string_lis:
        char0 = string[0]
        if char0 < 't':
            # +
            length = (alpha.find('t')+1) - (alpha.find(char0)+1)
            plus(string, length)
            # -
            length = (alpha.find(char0)+1) + 6
            minus(string, length)
                
        elif 't' < char0:
            # +
            length = 26 - (alpha.find(char0)+1) + 20
            new_str = plus(string, length)
            check(new_str, length, '+')
            # -
            length = (alpha.find(char0)+1) - 20
            new_str = minus(string, length)
            check(new_str, length, '-')
    
def plus(string, length):
    new_str = ''
    for char in string:
        index = alpha.find(char) + length
        if index <= 25:
            new_str += alpha[index]
        else:
            index = index - 26
            new_str += alpha[index]
    
    return new_str
        
def minus(string, length):
    new_str = ''
    for char in string:
        index = alpha.find(char) - length
        if index >= 0:
            new_str += alpha[index]
        else:
            index = 25 + index + 1
            new_str += alpha[index]
            
    return new_str

def check(new_str, length, flag):
    result_lis = []
    if new_str == 'the' or new_str == 'this' or new_str == 'that':
        if flag == '+':
            for string in string_lis:
                result_lis.append(plus(string, length))
        elif flag == '-':
            for string in string_lis:
                result_lis.append(minus(string, length))
        
    print ' '.join(result_lis)
    sys.exit()

if __name__ == '__main__':    
    for input_line in sys.stdin:
        input_line = input_line.rstrip('.\n')
        alpha = 'abcdefghijklmnopqrstuvwxyz'
        string_lis = input_line.split()
        check1()

Submission status: Wrong Answer

Solution code:
import sys

def check1():
    for string in string_lis:
        char0 = string[0]
        if char0 < 't':
            length = (alpha.find('t')+1) - (alpha.find(char0)+1)
            plus(string, length)
                
        elif 't' < char0:
            length = 26 - (alpha.find(char0)+1) + 20
            new_str = plus(string, length)
            check(new_str, length, '+')
    
def plus(string, length):
    new_str = ''
    for char in string:
        index = alpha.find(char) + length
        if index <= 25:
            new_str += alpha[index]
        else:
            index = index - 26
            new_str += alpha[index]
    
    return new_str
        
def check(new_str, length, flag):
    result_lis = []
    if new_str == 'the' or new_str == 'this' or new_str == 'that':
        if flag == '+':
            for string in string_lis:
                result_lis.append(plus(string, length))
        
    print ' '.join(result_lis)
    sys.exit()

if __name__ == '__main__':    
    for input_line in sys.stdin:
        input_line = input_line.rstrip('.\n')
        alpha = 'abcdefghijklmnopqrstuvwxyz'
        string_lis = input_line.split()
        check1()

Submission status: Wrong Answer

Solution code:
import sys

def check1():
    for string in string_lis:
        char0 = string[0]
        if char0 < 't':
            length = 20 - (alpha.find(char0)+1)
            plus(string, length)
                
        elif 't' < char0:
            length = 26 - (alpha.find(char0)+1) + 20
            new_str = plus(string, length)
            check(new_str, length, '+')
    
def plus(string, length):
    new_str = ''
    for char in string:
        index = alpha.find(char) + length
        if index <= 25:
            new_str += alpha[index]
        else:
            index = index - 26
            new_str += alpha[index]
    
    return new_str
        
def check(new_str, length, flag):
    result_lis = []
    if new_str == 'the' or new_str == 'this' or new_str == 'that':
        if flag == '+':
            for string in string_lis:
                result_lis.append(plus(string, length))
        
    print ' '.join(result_lis)
    sys.exit()

if __name__ == '__main__':    
    for input_line in sys.stdin:
        input_line = input_line.rstrip('.\n')
        alpha = 'abcdefghijklmnopqrstuvwxyz'
        string_lis = input_line.split()
        check1()

Submission status: Wrong Answer

Solution code:
import sys

def check1():
    for string in string_lis:
        char0 = string[0]
        if char0 < 't':
            length = 20 - (alpha.find(char0)+1)
            new_str = plus(string, length)
            check(new_str, length)
                
        elif 't' < char0:
            length = 26 - (alpha.find(char0)+1) + 20
            new_str = plus(string, length)
            check(new_str, length)
    
def plus(string, length):
    new_str = ''
    for char in string:
        index = alpha.find(char) + length
        if index <= 25:
            new_str += alpha[index]
        else:
            index = index - 26
            new_str += alpha[index]
    
    return new_str
        
def check(new_str, length):
    result_lis = []
    if new_str == 'the' or new_str == 'this' or new_str == 'that':
        for string in string_lis:
            result_lis.append(plus(string, length))
        
    print ' '.join(result_lis)
    sys.exit()

if __name__ == '__main__':    
    for input_line in sys.stdin:
        input_line = input_line.rstrip('.\n')
        alpha = 'abcdefghijklmnopqrstuvwxyz'
        string_lis = input_line.split()
        check1()

Submission status: Wrong Answer

Solution code:
import sys

def check1():
    for string in string_lis:
        char0 = string[0]
        if char0 < 't':
            length = 20 - (alpha.find(char0)+1)
            new_str = plus(string, length)
            check(new_str, length)
                
        elif 't' < char0:
            length = 26 - (alpha.find(char0)+1) + 20
            new_str = plus(string, length)
            check(new_str, length)
    
def plus(string, length):
    new_str = ''
    for char in string:
        if char == '.':
            new_str += '.'
            continue
        index = alpha.find(char) + length
        if index <= 25:
            new_str += alpha[index]
        else:
            index = index - 26
            new_str += alpha[index]
    
    return new_str
        
def check(new_str, length):
    result_lis = []
    if new_str == 'the' or new_str == 'this' or new_str == 'that':
        for string in string_lis:
            result_lis.append(plus(string, length))
        
    print ' '.join(result_lis)
    sys.exit()

if __name__ == '__main__':    
    for input_line in sys.stdin:
        input_line = input_line.rstrip('\n')
        alpha = 'abcdefghijklmnopqrstuvwxyz'
        string_lis = input_line.split()
        check1()

Submission status: Wrong Answer

Solution code:
l=map(str,raw_input().split())
n=1
while n<27:
    ans=[]
    for i in l:
        x=''
        for j in i:
            s=ord(j)+n
            if s>=123:
                s-=26
            if s<97:
                s=46
            x+=chr(s)
        ans.append(x)
    if 'that' in ans or 'thet.' in ans or 'this' in ans or 'this.' in ans or 'the' in ans or 'the.' in ans:
        print ' '.join(ans)
        exit()
    n+=1

Submission status: Wrong Answer

Solution code:
def sol(l):
    n=1
    while n<27:
        ans=[]
        for i in l:
            x=''
            for j in i:
                s=ord(j)+n
                if s>=123:
                    s-=26
                if s<97:
                    s=46
                x+=chr(s)
            ans.append(x)
        if 'that' in ans or 'thet.' in ans or 'this' in ans or 'this.' in ans or 'the' in ans or 'the.' in ans:
            print ' '.join(ans)
            exit()
        n+=1

while 1:
    try:
        w=map(str,raw_input().split())
        sol(w)
    except:
        break

Submission status: Wrong Answer

Solution code:
import string
# s = raw_input()
s = 'xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.'
def cipher(s, shift):
    abc = string.ascii_lowercase
    t = ''
    for c in s:
        if c == 'a':
            c = 'z'
        elif c in abc:
            c = chr(ord(c) - shift)
        t += c
    return t
def decode(s):
    shift = 0
    for i in range(len(s) - 3):
        if (ord(s[i]) - ord(s[i + 1])) % 26 == 12:
            if ((ord(s[i + 1]) - ord(s[i + 2])) % 26 == 3 or 7 or 25) and (i < len(s) - 3 and s[i] == s[i + 4]):
                shift = (ord(s[i]) - ord('t')) % 26
                break
    return cipher(s, shift)
print decode(s)

Submission status: Wrong Answer

Solution code:
s = raw_input()
# s = 'xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.'
# s = 'aopz'
def cipher(s, shift):
    abc = 'abcdefghijklmnopqrstuvwxyz'
    t = ''
    for c in s:
        if c in abc:
            if ord(c) - ord('a') < shift:
                c = chr(ord(c) + 26 - shift)
            else:
                c = chr(ord(c) - shift)
        t += c
    return t
def decode(s):
    shift = 0
    for i in range(len(s) - 2):
        if (ord(s[i]) - ord(s[i + 1])) % 26 == 12:
            if ((ord(s[i + 1]) - ord(s[i + 2])) % 26 == 3) or (i < len(s) - 3 and (((ord(s[i + 1]) - ord(s[i + 2])) % 26 == 7 and s[i] == s[i + 3]) or ((ord(s[i + 1]) - ord(s[i + 2])) % 26 == 25 and (ord(s[i + 2]) - ord(s[i + 3])) % 26 == 16))):
                shift = (ord(s[i]) - ord('t')) % 26
                break
    return cipher(s, shift)
print decode(s)