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:
while True:
    try:
        s = input()[:-1].split()
    except:
        exit()
        
    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) + '.')

Submission status: Wrong Answer

Solution code:
while True:
    try:
        s = input()
    except:
        exit()

    s = s[:-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) + '.')

Submission status: Wrong Answer

Solution code:
def func(s):
    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') )
                    print(t)
                li.append(t)
            if 'this' in li or 'that' in li or 'the' in li:
                print(" ".join(li) + '.')
                return


while True:
    try:
        s = input()
    except:
        exit()

    s = s[:-1].split()
    func(s)

Submission status: Wrong Answer

Solution code:
while 1:
    try:
        n=float('inf')
        s=raw_input().strip('.').split()
        for i in xrange(26):
            for j in s:
                r1=[]
                r2=[]
                for k in j:
                    r1.append(chr(ord(k)+i))
                    r2.append(chr(ord(k)-i))
                if "".join(r1)=="this" or "".join(r1)=="that" or "".join(r1)=="the":
                    n=i
                if "".join(r2)=="this" or "".join(r2)=="that" or "".join(r2)=="the":
                    n=-i
            if n!=float('inf'):
                break
        ans=[]
        for i in s:
            splitans=[]
            for j in i:
                splitans.append(chr(ord(j)+n))
            ans.append(''.join(splitans))
        print(' '.join(ans)+'.')
    except:
        break

Submission status: Wrong Answer

Solution code:
while 1:
    try:
        n=float('inf')
        s=raw_input().strip('.').split()
        for i in xrange(26):
            for j in s:
                r=[]
                for k in j:
                    r.append(chr(97+((ord(k)+i)/123)*(ord(k)+i-122)))
                if "".join(r)=="this" or "".join(r)=="that" or "".join(r)=="the":
                    n=i
            if n!=float('inf'):
                break
        ans=[]
        for i in s:
            splitans=[]
            for j in i:
                splitans.append(chr(97+((ord(j)+n)/123)*(ord(j)+n-122)))
            ans.append(''.join(splitans))
        print(' '.join(ans)+'.')
    except:
        break

Submission status: Wrong Answer

Solution code:
while 1:
    try:
        n=float('inf')
        s=raw_input().strip('.').split()
        for i in xrange(26):
            for j in s:
                r=[]
                for k in j:
                    if ord(k)+i<123:
                        r.append(chr(ord(k)+i))
                    else:
                        r.append(chr(97+ord(k)+i-123))
                if "".join(r)=="this" or "".join(r)=="that" or "".join(r)=="the":
                    n=i
            if n!=float('inf'):
                break
        ans=[]
        for i in s:
            splitans=[]
            for j in i:
                if ord(j)+n<123:
                    splitans.append(chr(ord(j)+n))
                else:
                    splitans.append(chr(97+ord(j)+n-123))
            ans.append(''.join(splitans))
        print(' '.join(ans)+'.')
    except:
        break

Submission status: Wrong Answer

Solution code:
# coding: utf-8

def casar(s, n):
  d = {}
  for c in (65, 97):
    for i in range(26):
      d[chr(i+c)] = chr((i+n) % 26 + c)

  return "".join([d.get(c, c) for c in s])
  
encrypttxt = raw_input()

for i in range(26):
  if  "the" in casar(encrypttxt, i) or "this" in  casar(encrypttxt, i) or "that" in casar(encrypttxt, i):
    print casar(encrypttxt, i)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

def casar(s, n):
  d = {}
  for c in (65, 97):
    for i in range(26):
      d[chr(i+c)] = chr((i+n) % 26 + c)

  return "".join([d.get(c, c) for c in s])
  
encrypttxt = raw_input()

for i in range(26):

  t = casar(encrypttxt, i)

  if  "the" in t or "this" in t or "that" in t:
    print t

Submission status: Wrong Answer

Solution code:
def casar(s, n):
  d = {}
  for c in (65, 97):
    for i in range(26):
      d[chr(i+c)] = chr((i+n) % 26 + c)

  return "".join([d.get(c, c) for c in s])
  
encrypttxt = raw_input()

for i in range(26):
  t = casar(encrypttxt, i)
  if  "the" in t or "this" in t or "that" in t:
    print t

Submission status: Wrong Answer

Solution code:
import string

def caeser(str,n):
    newstringa=""
    newstringb=""
    for c in str:
        if c in string.ascii_lowercase:
            i=string.ascii_lowercase.index(c)
            cc=(string.ascii_lowercase*2)[i+n]
            newstringa+=cc
            newstringb+=cc
        else:
            newstringa+=' '
            newstringb+=c
    return (newstringa,newstringb)

input=raw_input()
for n in range(1,26):
    [a,b]=caeser(input,n)
    cand=a.split(' ')
    ans=0
    for w in ['the','this','that']:
        if w in cand:
            ans=1
    if ans:
        print b
        break

Submission status: Wrong Answer

Solution code:
import string

def caeser(str,n):
    newstringa=""
    newstringb=""
    for c in str:
        if c in string.ascii_lowercase:
            i=string.ascii_lowercase.index(c)
            cc=(string.ascii_lowercase*2)[i+n]
            newstringa+=cc
            newstringb+=cc
        else:
            newstringa+=' '
            newstringb+=c
    return (newstringa,newstringb)
while(1):
    try:
        input=raw_input()
        for n in range(1,26):
            [a,b]=caeser(input,n)
            cand=a.split(' ')
            ans=0
            for w in ['the','this','that']:
                if w in cand:
                    ans=1
            if ans:
                print b
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
import string

def caeser(str,n):
    newstringa=""
    newstringb=""
    for c in str:
        if c in string.ascii_lowercase:
            i=string.ascii_lowercase.index(c)
            cc=(string.ascii_lowercase*2)[i+n]
            newstringa+=cc
            newstringb+=cc
        else:
            newstringa+=' '
            newstringb+=c
    return (newstringa,newstringb)
while(1):
    try:
        input=raw_input()
        for n in range(1,26):
            [a,b]=caeser(input,n)
            cand=a.split(' ')
            ans=0
            for w in ['the','this','that']:
                if w in cand:
                    ans=1
                if w in b:
                    ans=1
            if ans:
                print b
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
import string
import sys

def caeser(str,n):
    newstringa=""
    newstringb=""
    for c in str:
        if c in string.ascii_lowercase:
            i=string.ascii_lowercase.index(c)
            cc=(string.ascii_lowercase*2)[i+n]
            newstringa+=cc
            newstringb+=cc
        else:
            newstringa+=' '
            newstringb+=c
    return (newstringa,newstringb)
    
input=sys.stdin.readline()
for n in range(1,26):
    [a,b]=caeser(input,n)
    cand=a.split(' ')
    ans=0
    for w in ['the','this','that']:
        if w in cand:
            ans=1
    if ans:
        print b
        break

Submission status: Wrong Answer

Solution code:
import string
import sys

def caeser(str,n):
    newstringa=""
    newstringb=""
    for c in str:
        if c in string.ascii_lowercase:
            i=string.ascii_lowercase.index(c)
            cc=(string.ascii_lowercase*2)[i+n]
            newstringa+=cc
            newstringb+=cc
        else:
            newstringa+=' '
            newstringb+=c
    return (newstringa,newstringb)
    
input=sys.stdin.readline()
for n in range(1,26):
    [a,b]=caeser(input,n)
    cand=a.split(' ')
    ans=0
    for w in ['the','this','that']:
        if w in cand:
            ans=1
        if w in b:
            ans=1
    if ans:
        print b
        break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
import re

def move(char, num):
    if ord(char) + num <= ord('z'):
        return ord(char) + num
    else:
        return ord(char) + num - (ord('z') - ord('a') + 1)

def shift(s, num):
    new = ""
    for i in range(0, len(s)):
        if s[i].isalpha():
            new += str(chr(move(s[i], num)));
        else:
            new += s[i]
    return new

def decrypt(s):
    for i in range(1, 26):
        decrypted = shift(s, i)
        if re.search('the|this|that', decrypted):
            print(decrypted)

if __name__ == '__main__':
    crypted = input()
    print(decrypt(crypted))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
import sys
import re

def move(char, num):
    if ord(char) + num <= ord('z'):
        return ord(char) + num
    else:
        return ord(char) + num - (ord('z') - ord('a') + 1)

def shift(s, num):
    new = ""
    for i in range(0, len(s)):
        if s[i].isalpha():
            new += str(chr(move(s[i], num)));
        else:
            new += s[i]
    return new

def decrypt(s):
    for i in range(1, 26):
        decrypted = shift(s, i)
        if re.search('the|this|that', decrypted):
            print(decrypted)

if __name__ == '__main__':
    for line in sys.stdin:
        print(decrypt(line))

Submission status: Wrong Answer

Solution code:
import sys

a = 'abcdefghijklmnopqrstuvwxyz'
for i in sys.stdin.readlines():
    s = i.strip()
    for j in range(1, 26):
        t = s.translate(str.maketrans(a, a[j:] + a[:j]))
        if 'the' in t or 'this' in t or 'that' in t:
            print(t)

Submission status: Wrong Answer

Solution code:
def ceasar(sentence, n):
    sentence = list(sentence)
    for i in range(len(sentence)):
        if sentence[i] in alphabets:
            sentence[i] = alphabets[(alphabets.index(sentence[i]) + n) % 26]
    return ''.join(sentence)
def is_right(sentence):
    words = '.'.join(sentence.split(' ')).split('.')
    return ('the' or 'this' or 'that') in words
alphabets = 'abcdefghijklmnopqrstuvwxyz'
while True:
    try:
        line = input()
        if line == '*':
            break
    except:
        break
    for i in range(26):
        if is_right(ceasar(line, i)):
            print(ceasar(line, i))
            break

Submission status: Wrong Answer

Solution code:
def rot(n, s):
    r = ''
    for c in s:
        if c == ' ' or c == '.' : r+= c
        else: r += chr((ord(c) - ord('a') + n) % 26 + ord('a'))
    return r

while 1:
    try:
        s = raw_input()
        n = 0
        for i in xrange(25):
            if 't' == rot(i, s[0]): n = i
        print rot(n, s)
    except:
        break

Submission status: Wrong Answer

Solution code:
worddic = {}

def caesar(n, word):
	rword = ''
	for char in word:
		rword += chr(ord('a') + (ord(char) - ord('a') + n) % 26)
	return rword

for i in range(1,26):
	worddic[caesar(i, 'the')] = i
	worddic[caesar(i, 'this')] = i
	worddic[caesar(i, 'that')] = i

str = raw_input()
for word in str.strip('.').split(' '):
	if word in worddic.keys():
		decode = worddic[word]

print ' '.join([caesar(26-decode, word) for word in str.strip('.').split(' ')]) + '.'

Submission status: Wrong Answer

Solution code:
worddic = {}

def caesar(n, word):
	rword = ''
	for char in word:
		rword += chr(ord('a') + (ord(char) - ord('a') + n) % 26)
	return rword

for i in range(1,26):
	worddic[caesar(i, 'the')] = i
	worddic[caesar(i, 'this')] = i
	worddic[caesar(i, 'that')] = i

str = raw_input()
for word in str.strip('.').split(' '):
	if word in worddic.keys():
		decode = worddic[word]
		break

print ' '.join([caesar(26-decode, word) for word in str.strip('.').split(' ')]) + '.'

Submission status: Wrong Answer

Solution code:
worddic = {}

def caesar(n, word):
	rword = ''
	for char in word:
		rword += chr(ord('a') + (ord(char) - ord('a') + n) % 26)
	return rword

for i in range(1,26):
	worddic[caesar(i, 'the')] = i
	worddic[caesar(i, 'this')] = i
	worddic[caesar(i, 'that')] = i

str = raw_input()
for word in str.strip('.').split(' '):
	if word in worddic.keys():
		decode = worddic[word]
		break

print ' '.join([caesar(26-decode, word) for word in str.strip('.').split(' ')]) + ('.' if str.find('.')>0 else '')

Submission status: Wrong Answer

Solution code:
worddic = {}

def caesar(n, word):
	rword = ''
	for char in word:
		rword += chr(ord('a') + (ord(char) - ord('a') + n) % 26)
	return rword

for i in range(0,26):
	worddic[caesar(i, 'the')] = i
	worddic[caesar(i, 'this')] = i
	worddic[caesar(i, 'that')] = i

str = raw_input()
for word in str.strip('.').split(' '):
	if word in worddic.keys():
		decode = worddic[word]
		break

print ' '.join([caesar(26-decode, word) for word in str.strip('.').split(' ')]) + ('.' if str.find('.')>0 else '')

Submission status: Wrong Answer

Solution code:
worddic = {}

def caesar(n, word):
	rword = ''
	for char in word:
		rword += chr(ord('a') + (ord(char) - ord('a') + n) % 26)
	return rword

for i in range(0,26):
	worddic[caesar(i, 'the')] = i
	worddic[caesar(i, 'this')] = i
	worddic[caesar(i, 'that')] = i

str = raw_input()
for word in str.strip('. \n').split(' '):
	if word in worddic.keys():
		decode = worddic[word]
		break

print ' '.join([caesar(26-decode, word) for word in str.strip('. \n').split(' ')]) + ('.' if str.find('.')>0 else '')

Submission status: Wrong Answer

Solution code:
line = input().split(' ')
alpha_li = [chr(i) for i in range(97,97+26)]
keys = ['the','this','that']
idx_t = alpha_li.index('t')
def look_for_n(li):
    shift_n = alpha_li.index(li[0]) - idx_t
    if rot(shift_n,li) in keys: return(shift_n)
    else: return(False)
def rot(n,li):
    str = ''
    for s in li:
        if s.isalpha(): str += alpha_li[(alpha_li.index(s)-n)%25]
        else: str += s
    return(str)

for word in line:
    rot_n = look_for_n(list(word))
    if rot_n: break
for k,word in enumerate(line):
    line[k] = rot(rot_n,list(word))
print(' '.join(line))

Submission status: Wrong Answer

Solution code:
def cshift(w):
    r = ""
    for c in w:
        if c == 'z':
            r += 'a'
        else:
            r += chr(ord(c)+1)
    return r
while True:
    try:
        sent = input()
    except EOFError:
        break
    
    words = sent[:-1].split()
    while ("the" not in words) and ("this" not in words) and ("that" not in words):
        for i, w in enumerate(words):
            words[i] = cshift(w)
    print(" ".join(words)+".")

Submission status: Wrong Answer

Solution code:
import sys


def decrypt(c, i):
    """ ????????¶????????? """
    if c.isalpha():
        t = ord(c) - i
        if t < ord('a'):
            t = ord('z') - i + 1
        return chr(t)
    else:
        return c


if __name__ == '__main__':
    # ??????????????\???
    for line in sys.stdin:

        # ?????????????????????
        found = ''  # ?????????????????????
        for i in range(1, 25):
            decrypted = ''.join([decrypt(x, i) for x in line])
            # print(decrypted)
            if 'the' in decrypted or 'this' in decrypted or 'that' in decrypted:
                found = decrypted
                break

        # ???????????????
        if found:
            print(found)

Submission status: Wrong Answer

Solution code:
import sys


def decrypt(c, i):
    """ ????????¶????????? """
    if c.isalpha():
        t = ord(c) - i
        if t < ord('a'):
            t = ord('z') - i + 1
        return chr(t)
    else:
        return c


if __name__ == '__main__':
    # ??????????????\???
    for line in sys.stdin:

        # ?????????????????????
        found = ''  # ?????????????????????
        for i in range(1, 25):
            decrypted = ''.join([decrypt(x, i) for x in line.strip()])
            # print(decrypted)
            if 'the' in decrypted or 'this' in decrypted or 'that' in decrypted:
                found = decrypted
                break

        # ???????????????
        if found:
            print(found)

Submission status: Wrong Answer

Solution code:
import sys


def decrypt(c, i):
    """ ????????¶????????? """
    if c.isalpha():
        t = ord(c) - i
        if t < ord('a'):
            t = ord('z') - i + 1
        return chr(t)
    else:
        return c


if __name__ == '__main__':
    # ??????????????\???
    for line in sys.stdin:

        # ?????????????????????
        found = ''  # ?????????????????????
        for i in range(0, 26):
            decrypted = ''.join([decrypt(x, i) for x in line.strip()])
            # print(decrypted)
            if 'the' in decrypted or 'this' in decrypted or 'that' in decrypted:
                found = decrypted
                break

        # ???????????????
        if found:
            print(found)

Submission status: Wrong Answer

Solution code:
import sys


def decrypt(c, i):
    """ ????????¶????????? """
    if c.isalpha():
        t = ord(c) - i
        if t < ord('a'):
            t = ord('z') - i + 1
        return chr(t)
    else:
        return c


if __name__ == '__main__':
    # ??????????????\???
    for line in sys.stdin:

        # ?????????????????????
        found = ''  # ?????????????????????
        for i in range(0, 26):
            decrypted = ''.join([decrypt(x, i) for x in line.strip()])
            # print(decrypted)
            if ' the ' in decrypted or ' this ' in decrypted or ' that ' in decrypted or \
                    decrypted.startswith('the ') or decrypted.startswith('this ') or decrypted.startswith('that '):
                found = decrypted
                break

        # ???????????????
        if found:
            print(found)

Submission status: Wrong Answer

Solution code:
def chg(s,n):
    res=""
    for i in s:
        o=ord(i)
        if 97<=o<=122:
            if o+n<=122:
                res+=chr(o+n)
            else:
                res+=chr(o+n-26)
        else:
            res+=i
    return res

while True:
    try:
        s=input()
        for i in range(26):
            c=chg(s,i)
            if ("the" or "this" or "that") in list(c.split()):
                print(c)
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
def chg(s,n):
    res=""
    for i in s:
        o=ord(i)
        if 97<=o<=122:
            if o+n<=122:
                res+=chr(o+n)
            else:
                res+=chr(o+n-26)
        else:
            res+=i
    return res

while True:
    try:
        s=input()
        for i in range(25,-1,-1):
            c=chg(s,i)
            if ("the" or "this" or "that") in c.split():
                print(c)
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
def decode(s, n):
    a = ""
    for i in s:
        if i.isalpha():
            a += chr((ord(i) - 97 + n) % 26 + 97)
        else:
            a += i
    return a

def judge(s):
    a = s.split()
    return ("the"or"that"or"this") in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(1, 26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

Submission status: Wrong Answer

Solution code:
def decode(s, n):
    a = ""
    for i in s:
        if i.isalpha():
            a += chr((ord(i) - 97 + n) % 26 + 97)
        else:
            a += i
    return a

def judge(s):
    a = s.split()
    return "the" in a or "this" in a or "that" in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(1, 26):
        a = decode(s, i)
        if judge(a):
            break

Submission status: Wrong Answer

Solution code:
def decode(s, n):
    a = ""
    for i in s:
        if i.isalpha():
            a += chr((ord(i) - 97 + n) % 26 + 97)
        else:
            a += i
    return a

def judge(s):
    a = s.split()
    return "the" in a or "this" in a or "that" in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(1, 26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

Submission status: Wrong Answer

Solution code:
def decode(s, n):
    a = ""
    for i in s:
        if i.islower():
            a += chr((ord(i) - 97 + n) % 26 + 97)
        else:
            a += i
    return a

def judge(s):
    a = s.split()
    return "the" in a or "this" in a or "that" in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(1, 26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

Submission status: Wrong Answer

Solution code:
def decode(s, n):
    a = ""
    for i in s:
        if i.islower():
            a += chr((ord(i) - 97 + n) % 26 + 97)
        else:
            a += i
    return a

def judge(s):
    a = s.strip(".").split()
    return "the" in a or "this" in a or "that" in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(1, 26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

Submission status: Wrong Answer

Solution code:
def decode(s, n):
    a = ""
    for i in s:
        if i.islower():
            o = ord(i) + n
            if o <= 122:
                a += chr(o)
            else:
                a += chr(o - 26)
        else:
            a += i
    return a

def judge(s):
    a = s.rstrip(".").split()
    return "the" in a or "this" in a or "that" in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(1, 26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

Submission status: Wrong Answer

Solution code:
def decode(s, n):
    a = ""
    for i in s:
        if i.islower():
            o = ord(i) + n
            if o <= 122:
                a += chr(o)
            else:
                a += chr(o - 26)
        else:
            a += i
    return a

def judge(s):
    a = s.split()
    return "the" in a or "this" in a or "that" in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(1, 26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

Submission status: Wrong Answer

Solution code:
s = list(map(str,input()))
t = []
for c in s:
    t.append(ord(c))    

for i in range(26):
    string = ''
    for j in range(len(s)):
        if t[j] >= 97 and 122 >= t[j]:
            l = 97 + ((t[j] - 97 + i) % 26)
            string += chr(l)
            
        else:
            string += chr(t[j])
    if 'this' in string or 'the' in string or 'that' in string:
        print(string)

Submission status: Wrong Answer

Solution code:
d= dict(zip([chr(i) for i in range(97, 123)], [chr(i) for i in range(119,123)]+[chr(i) for i in range(97, 119)]))
while 1:
    try:
        text= input()
        for i in input():
            t= d.get(i)
            print(i if t== None else t, end='')
        print()
    except:
        break

Submission status: Wrong Answer

Solution code:
d= dict(zip([chr(i) for i in range(97, 123)], [chr(i) for i in range(119,123)]+[chr(i) for i in range(97, 119)]))
while 1:
    try:
        for i in input():
            t= d.get(i)
            print(i if t== None else t, end='')
        print()
    except:
        break

Submission status: Wrong Answer

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

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

alphabet = 'abcdefghijklmnopqrstuvwxyz'


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

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

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

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

Submission status: Wrong Answer

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

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

alphabet = 'abcdefghijklmnopqrstuvwxyz'


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

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

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

s = input().strip()
for i in range(1, 26):
    rotated = rotate_string(s, i)
    if 'the' in rotated or 'this' in rotated or 'that' in rotated:
        print(rotated, end='')
        break

Submission status: Wrong Answer

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

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

alphabet = 'abcdefghijklmnopqrstuvwxyz'


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

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

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

s = input().strip()
for i in range(1, 26):
    rotated = rotate_string(s, i)
    if 'the' in rotated or 'this' in rotated or 'that' in rotated:
        print(rotated, end='')
        break

Submission status: Wrong Answer

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

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

alphabet = 'abcdefghijklmnopqrstuvwxyz'


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

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

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

s = input()
for i in range(1, 26):
    rotated = rotate_string(s, i)
    if 'the' in rotated or 'this' in rotated or 'that' in rotated:
        print(rotated, end='')
        break

Submission status: Wrong Answer

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

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

alphabet = 'abcdefghijklmnopqrstuvwxyz'


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

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

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

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

Submission status: Wrong Answer

Solution code:
def restore(n,text):
    text_list=list(text)
    for i,j in enumerate(text_list):
        if ord(j)!=46 and ord(j)!=32:
            nw=ord(j)-n
            if nw<97:
                nw=ord(j)-n+26
            text_list[i]=chr(nw)
    for i in text_list:
        print(i,end='')
    print('\n')

def textsa(str):
    str_list=list(str)
    n=len(str_list)
    sa=[]
    for i in range(n-1):
        sa.append((ord(str_list[i+1])-ord(str_list[i]))%26)
    sa.append((ord(str_list[0])-ord(str_list[n-1]))%26)
    return sa


text=input()
str=list(map(str,text.split()))
for i in str:
    if textsa(i)==[14,1,10,1] or textsa(i)==[14,19,19,0]:
        n=ord(list(i)[0])-ord('t')
    if textsa(i)==[14,23,15]:
        n=ord(list(i)[0])-ord('t')
        
restore(n,text)

Submission status: Wrong Answer

Solution code:
def restore(n,text):
    text_list=list(text)
    for i,j in enumerate(text_list):
        if ord(j)!=46 and ord(j)!=32:
            nw=ord(j)-n
            if nw<97:
                nw=ord(j)-n+26
            text_list[i]=chr(nw)
    print(''.join(map(str,text_list)))

def textsa(text):
    str_list=list(text)
    n=len(str_list)
    sa=[]
    for i in range(n-1):
        sa.append((ord(str_list[i+1])-ord(str_list[i]))%26)
    sa.append((ord(str_list[0])-ord(str_list[n-1]))%26)
    return sa


while True:
    try:
        text=input()
        wordlist=list(map(str,text.split()))
        for i in wordlist:
            if textsa(i)==[14,1,10,1] or textsa(i)==[14,19,19,0] or textsa(i)==[14,23,15]:
                n=ord(list(i)[0])-ord('t')
        restore(n,text)
    except:
        break