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.

Solution (Python):
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

Solution (Python):
import sys,string
a = string.ascii_lowercase
t = string.maketrans(a,a[1:]+a[0])
        
for s in sys.stdin:
    s = s.strip()
    while not ('the' in s or 'this' in s or 'that' in s):
        s = s.translate(t)
    print s

Solution (Python):
import sys

while True:
    try:
        input = raw_input()
        for i in range(0, 26):
            str = ""
            for c in input:
                if c.isalpha():
                    c = chr(ord(c) + i)
                    if ord(c) > ord('z'):
                        c = chr(ord('a') - ord('z') + ord(c) - 1)
                str += c
            for word in ["this", "that", "the"]:
                if (str.find(word) != -1):
                    print str
                    break
    except EOFError:
        break

Solution (Python):
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" in cipher_str or "this" in cipher_str or "that" in cipher_str:
            print(cipher_str, end="")
            break
    else:
        print(line, end="")

Solution (Python):
while(True):
    try:
        s = raw_input()
        for i in range(26):
            for j in range(len(s)):
                if('a' <= s[j] <= 'y'):
                    s = s[0:j:] + chr(ord(s[j]) + 1) + s[j + 1::]
                elif(s[j] == 'z'):
                    s = s[0:j:] + 'a' + s[j + 1::]
            if("this" in s or "that" in s or "the" in s):
                print(s)
    except Exception:
        break

Solution (Python):
def mov(c,x):
    if ord('a')<=ord(c)<=ord('z'):
        return chr(ord('a')+(ord(c)-ord('a')+x)%26)
    else:
        return c

while True:
    try:
        s=raw_input()
        flag=False
        for i in xrange(26):
            t=''.join([mov(c,i) for c in s])
            
            ts=t[:-1].split()
            if ('this' in ts) or ('that' in ts) or ('the' in ts ):
                flag=True
                break
        if flag:
            print t
    except EOFError: break

Solution (Python):




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("")
    elif e == " ":
      lis.append(" ")
    else:
      if ord(e)+i > 122:
        lis.append( chr(ord(e)+i-26) )
      else:
        lis.append( chr(ord(e)+i ) )
  st = "".join(lis)
  return st

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

Solution (Python):
import sys
import string
f = sys.stdin

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

for sentence in f:
    for i in range(len(string.ascii_lowercase)):
        sentence = sentence.translate(ceasar1)
        if 'the' in sentence or 'this' in sentence or 'that' in sentence:
            print(sentence, end='')
            break

Solution (Python):
import sys

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

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

Solution (Python):
import sys
alpha = 'abcdefghijklmnopqrstuvwxyz'
def this(word):
    i=0
    t=[]
    for c in word:
        x=ord(c)-ord('this'[i])
        if x>=0:
            t.append(x)
        else:
            t.append(26+x)
    
        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:
        x=ord(c)-ord('that'[i])
        if x>=0:
            t.append(x)
        else:
            t.append(26+x)
    
        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:
        x=ord(c)-ord('the'[i])
        if x>=0:
            t.append(x)
        else:
            t.append(26+x)
    
        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

    result=""
    for c in string:
        if c in alpha:
            result+=alpha[alpha.find(c)-x]
        else:
            result+=c
    print result[:-1]

Solution (Python):
while True:
    try:
        s = raw_input()
    except EOFError:
        break
    for i in range(26):
    	S = ''
    	for c in s:
    		if c.islower():
    			n = (ord(c)-ord('a')+i)%26
    			S +=chr(ord('a')+n)
    		else:
    			S += c
    	if 'the' in S or 'this' in S or 'that' in S:
    		print S
    		break

Solution (Python):
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])

while True:
    try:
        sent = input().split()
    except:
        break

    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))

Solution (Python):
import sys
c=lambda w,n:reduce(lambda a,b:a+b,[chr((ord(x)-97+n)%26+97)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 r in["this","that"]:n=116-ord(s[0])
	print c(i,n).replace("\n","")

Solution (Python):
import sys
c=lambda w,n:reduce(lambda a,b:a+b,[chr((ord(x)-97+n)%26+97)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 r in["this","that"]:n=116-ord(s[0])
	print c(i,n).replace("\n","")

Solution (Python):
import sys,re
c=lambda w,n:"".join([chr((ord(x)-97+n)%26+97)if x.isalpha()else x for x in w])
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):
import sys,re
c=lambda l,n:re.sub("[a-z]",lambda x:chr((ord(x.group(0))-97+n)%26+97),l)
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):
import sys,re
c=lambda l,n:re.sub("[a-z]",lambda x:chr((ord(x.group(0))-97+n)%26+97),l)
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):
import sys,re
c=lambda l,n:re.sub("[a-z]",lambda x:chr((ord(x.group(0))-97+n)%26+97),l)
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):
import sys,re
c=lambda l,n:re.sub("[a-z]",lambda x:chr((ord(x.group(0))-97+n)%26+97),l)
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):
import sys,re
c=lambda l,n:re.sub("\w",lambda x:chr((ord(x.group(0))-97+n)%26+97),l)
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):
import sys,re
c=lambda l,n:re.sub("\w",lambda x:chr((ord(x.group(0))-97+n)%26+97),l)
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):
import sys,re
c=lambda l,n:re.sub("\w",lambda x:chr((ord(x.group(0))-97+n)%26+97),l)
for i in sys.stdin:
	n=0
	while not re.search("th(e|is|at)",c(i,n)):n+=1
	print c(i,n).strip()

Solution (Python):



import sys
import math

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

        state = "".join(state)

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

Solution (Python):
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)
            break
        n+=1

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

Solution (Python):
from math import *
PI = 3.1415926535898
x = "this"
y = "the"
z = "that"
while True:
	try:
		s = str(raw_input())
		res = ""
		ans = ""
		for i in range(26):
			res = ""
			for a in s:
			 	if a.isalpha():
			 		c = chr(ord(a) + i)
			 		if ord(c) > ord('z'):
			 			c = chr(ord(c) - 26)
			 		elif ord(c) < ord('a'):
			 			c = chr(ord(c) + 26)
			 		res += c
			 	else:
			 		res += a
			if res.find(x) >= 0 or res.find(y) >= 0 or res.find(z) >= 0:
				ans = res
		print ans
	except EOFError:
		break

Solution (Python):
import string
import sys


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


for line in sys.stdin:
    alphabets = string.ascii_lowercase
    frequency = [t[1] for t in sorted([(line.count(s), ord(s)) for s in alphabets], reverse=True)]
    freq_chr_offset = (4, 0, 19, 8, 14)
    ss = list(map(lambda word: word.strip('.\n'), line.split()))
    sl3, sl4 = set(s for s in ss if len(s) == 3), set(s for s in ss if len(s) == 4)

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

    print(''.join(rotate_dict[s] if s.isalpha() else s for s in line), end='')

Solution (Python):
base = ord('a')
az = [chr(j) for j in range(base, base+26)]
def crack(s):
    i = -1
    while True:
        new = []
        for c in s:
            if 96 < ord(c) < 123:
                new.append(az[(ord(c)-19+i)%26])
            else:
                new.append(c)
        i -= 1
        yield ''.join(new)
while True:
    try:
        s = input()
    except:
        break
    c = crack(s)
    while True:
        ans = next(c)
        if 'the' in ans or 'this' in ans or 'that' in ans:
            print(ans)
            break

Solution (Python):
import string
import sys

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

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

Solution (Python):
import string
import sys

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

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

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

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

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

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

    return chr(y)

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

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

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

Solution (Python):
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'that' in s):
    s = s.translate(tbl)
  print s[:-1]

Solution (Python):


import sys
import codecs

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

Solution (Python):
import sys

abc = 'abcdefghijklmnopqrstuvwxyz'
lines = sys.stdin.readlines()
for line in lines:
    for i in range(26):
        abcshift = abc[i:]+abc[:i]
        decode = line.translate(str.maketrans(abc, abcshift))
        if 'the' in decode or 'this' in decode or 'that' in decode:
            print(decode, end = '')
            break

Solution (Python):
li = 'abcdefghijklmnopqrstuvwxyz'

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

    for d in range(1, 27):
        t = s[:-1].translate(str.maketrans(li, li[d:] + li[:d]))
        if 'the' in t or 'this' in t or 'that' in t:
            print(t + '.')
            break

Solution (Python):



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])

while True:
  try:
    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

  except EOFError:
    break

Solution (Python):



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])

while True:
  try:
    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

  except EOFError:
    break

Solution (Python):



def caesar(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])

while True:
  try:
    encrypttxt = raw_input()
    for i in range(26):
      t = caesar(encrypttxt, i)
      if  "the" in t or "this" in t or "that" in t:
        print t

  except EOFError:
    break

Solution (Python):
chars = 'abcdefghijklmnopqrstuvwxyz'
while True:
    try:
        string = input()
    except:
        exit()

    for i in range(1, 27):
        t = string.translate(string.maketrans(chars, chars[i:] + chars[:i]))
        if 'the' in t or 'this' in t or 'that' in t:
            print(t)

Solution (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(0, 26):
        decrypted = shift(s, i)
        if re.search('the|this|that', decrypted):
            return decrypted

if __name__ == '__main__':
    lines = []
    for line in sys.stdin:
        lines.append(line)
    for line in lines:
        print(decrypt(line), end="")

Solution (Python):
import sys

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

Solution (Python):
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' in words or 'this' in words 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

Solution (Python):
l = [['the', 'uif', 'vjg', 'wkh', 'xli', 'ymj', 'znk', 'aol', 'bpm', 'cqn', 'dro', 'esp', 'ftq', 'gur', 'hvs', 'iwt', 'jxu', 'kyv', 'lzw', 'max', 'nby', 'ocz', 'pda', 'qeb', 'rfc', 'sgd'], \
['this', 'uijt', 'vjku', 'wklv', 'xlmw', 'ymnx', 'znoy', 'aopz', 'bpqa', 'cqrb', 'drsc', 'estd', 'ftue', 'guvf', 'hvwg', 'iwxh', 'jxyi', 'kyzj', 'lzak', 'mabl', 'nbcm', 'ocdn', 'pdeo', 'qefp', 'rfgq', 'sghr'], \
['that', 'uibu', 'vjcv', 'wkdw', 'xlex', 'ymfy', 'zngz', 'aoha', 'bpib', 'cqjc', 'drkd', 'esle', 'ftmf', 'gung', 'hvoh', 'iwpi', 'jxqj', 'kyrk', 'lzsl', 'matm', 'nbun', 'ocvo', 'pdwp', 'qexq', 'rfyr', 'sgzs']]

while 1:
    try:
        s = raw_input()
        for w in l:
            for i in xrange(25):
                o = w[i]
                if s.find(w[i]) != -1:
                    r = ''
                    for c in s:
                        if c == ' ' or c == '.' : r+= c
                        else: r += chr((ord(c) - ord('a') - i) % 26 + ord('a'))
                    print r
                    break
            else:
                continue
            break
    except:
        break

Solution (Python):
import string

def cyp(strr,n):
    nstrr=''
    for c in strr:
        if c in string.lowercase:
            ind=string.lowercase.index(c)
            nstrr+=string.lowercase[(ind+n)%26]
        else:
            nstrr+=c
    return nstrr
while(1):
    try:
        s=raw_input()
        for i in range(26):
            nstrr=cyp(s,i)
            if ('the' in nstrr) or ('this' in nstrr) or ('that' in nstrr):
                print nstrr
                break
    except:
         break

Solution (Python):
import sys

def decode(s, n):
    ret = ''
    for c in s:
        if c.isalpha():
            ret += chr((ord(c)+n-ord('a'))%26+ord('a'))
        else:
            ret += c
    return ret

T = ['the', 'this', 'that']

for line in sys.stdin:
    s = line.rstrip()
    for i in xrange(26):
        if any(t in decode(s, i) for t in T):
            print decode(s, i)
            break

Solution (Python):
import sys

s = "abcdefghijklmnopqrstuvwxyz"

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

Solution (Python):
def cshift(w):
    r = ""
    for c in w:
        if c == 'z':
            r += 'a'
        elif c == '.':
            r += '.'
        else:
            r += chr(ord(c)+1)
    return r
while True:
    try:
        sent = input()
    except EOFError:
        break
    
    words = sent.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))

Solution (Python):
import sys


def decrypt(c, i):
    """ ????????¶????????? """
    if c.isalpha():
        t = ord(c) - i
        if t < ord('a'):
            t += 26
        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()])
            
            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)

Solution (Python):
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)
            e=c.split()
            if "the" in e or "this" in e or "that" in e:
                print(c)
                break
    except:
        break

Solution (Python):
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(26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

Solution (Python):
a='abcdefghijklmnopqrstuvwxyz'
while 1:
    try:s=input()
    except:break
    for i in range(1,27):
        b=''
        for x in s:
            b+=a[a.index(x)-i]if x in a else x
        if 'the' in b or 'this' in b or 'that' in b:print(b);break

Solution (Python):
import sys

def caesar(c):
  if c == "z":
    return "a"
  elif c == "Z":
    return "A"
  elif 65 <= ord(c) and ord(c) <= 122:
    return chr(ord(c)+1)
  else:
    return c

while True:
  text = sys.stdin.readline()
  if not text: break
  text = text.rstrip()
  while True:
    if "the" in text or "this" in text or "that" in text:
      print(text)
      break
    text = "".join(map(caesar, list(text)))

Solution (Python):
s = []
while True:
    try:
        s.append(input())
    except:
        break

for e in range(len(s)):
    st = list(map(str,s[e]))
    t = []
    for c in st:
        t.append(ord(c))    

    for i in range(26):
        string = ''
        for j in range(len(st)):
            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)

Solution (Python):
import re

def rot(i,s):
  s0 = 'abcdefghijklmnopqrstuvwxyz'
  sr = s0[i:] + s0[:i]
  s1 = '' 
  for i in range(len(s)):
      if s[i] in s0:
          s1 = s1 + sr[s0.find(s[i])]
      else:
          s1 = s1 + s[i]
  return(s1)

def cae(s):
  for i in range(26):
      ro =rot(i,s)
      if re.search(r'the',ro) or re.search(r'this',ro) or re.search(r'that',ro):
        return(rot(i,s))

if __name__ == "__main__":
    while True:
        try:
            s = input()
            print(cae(s))
        except:
            break

Solution (Python):
import sys
def unzip(instd):
    for i in range(26):
        search = ""
        for idx in instd:
            if 97 <= ord(idx) <= 122:
                if ord(idx) + i <= 122:
                    search += chr(ord(idx) + i)
                else:
                    search += chr(ord(idx) + i - 26)
            else:
                search += idx
        if 'the' in search or 'this' in search or 'that' in search:
            return search


for line in sys.stdin:
    print(unzip(line.rstrip()))

Solution (Python):
while True:
    try:
        words=input()
        
    except:
        break
    for j in range(26):
        word=""
        for i in range(len(words)):
            if 65<=ord(words[i])<=90:
                if ord(words[i])+j>90:
                    word+=chr(ord(word[i])+j-26)
                else:
                    word+=chr(ord(word[i])+j)
            elif 97<=ord(words[i])<=122:
                if ord(words[i])+j>122:
                    word+=chr(ord(words[i])+j-26)
                else:
                    word+=chr(ord(words[i])+j)    
            else:
                word+=words[i]
        if "the" in word or "this" in word or "that" in word:
            print(word)

Solution (Python):
import sys
import math as mas

li='abcdefghijklmnopqrstuvwxyz'
for t in sys.stdin:
	for i in range(30):
		a=t[:-1].translate(str.maketrans(li,li[i:]+li[:i]))
		if 1+a.find("this") or 1+a.find("that") or 1+a.find("the"):
			print(a)
			break

Solution (Python):


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

alphabet = 'abcdefghijklmnopqrstuvwxyz'


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

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

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

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

Solution (Python):

import sys
 
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in sys.stdin.readlines():
    aaa = i.strip()
    for j in range(1, 27):
        text = aaa.translate(str.maketrans(alpha, alpha[j:] + alpha[:j]))
        if 'the' in text or 'this' in text or 'that' in text:
            print(text)

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

Solution (Python):
from sys import stdin

def ascii2num(ascii):
    return ord(ascii) - 96

def num2ascii(num):
    return chr(num + 96)

def slide(word,num):
    return ''.join([num2ascii((ascii2num(ascii) - num) % 26 + 1) if ascii != '.' else '.' for ascii in word])

def includekeyword(words):
    for word in words:
        if word in keywords:
            return True
    return False

keywords = ['the', 'this', 'that']

decode = []
for row in stdin:
    words = row.split()
    for num in range(1,27):
        tmp = [slide(word,num) for word in words]
        if includekeyword(tmp):
            decode = tmp
            print(' '.join(decode))
            break

Solution (Python):
import string
a=string.ascii_lowercase
while True:
    try:
        s=input()
    except:
        break
    for i in range(1, 27):
        t = s[:-1].translate(str.maketrans(a, a[i:]+a[:i]))
        if 'the'in t or'that'in t or'this'in t:
            print(t+".")
            break

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

Solution (Python):
while True:
	try:
		s = input()
	except:
		break

	for i in range(26):
		ss = ""
		for c in s:
			if c == ' ' or c == '.':
				ss += c
				continue
			c = ord(c)
			c = (c-ord('a')+i)%26+ord('a')
			ss += chr(c)
		a = ss.split()
		if "the" in a or "this" in a or "that" in a:
			print(ss)
			break

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

while True:
    try:
        sentence = input()
    except EOFError:
        break
    while True:
        if "the" in sentence or "this" in sentence or "that" in sentence:
            break
        sentence = caesarshift(sentence)
    print(sentence)