Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		var result string
		line := scanner.Text()
		key := make(map[string]string)

		var i int32
		for ; i < 52; i++ {
			makeKey(key, i)
			result = decode(key, line)

			if strings.Contains(result, "the") {
				break
			} else if strings.Contains(result, "this") {
				break
			} else if strings.Contains(result, "that") {
				break
			}
		}

		fmt.Println(result)
	}
}

func makeKey(key map[string]string, shift int32) {
	for i := 'a'; i <= 'z'; i++ {
		cipher := (i + shift)
		if cipher > 'z' {
			cipher = cipher%'z' + 'a' - 1
		} else if cipher < 'a' {
			cipher = cipher + ('z' - 'a') + 1
		}
		key[string(i)] = string(cipher)
	}
}

func decode(key map[string]string, cipher string) string {
	var result string
	for _, v := range cipher {
		if key[string(v)] != "" {
			result += key[string(v)]
		} else {
			result += string(v)
		}
	}
	return result
}

C++: #include <iostream>
#include <string>
using namespace std;

int main(){
  string in;
  int g = 0;
  getline(cin , in);
  while(1){
    string t[3] = {"the", "that", "this"};
    for(int j=0; j<3; j++)
      for(int i=0; i<4; i++)
      t[j][i] += g;
    
    if(in.find(t[0]) == string::npos ||
       in.find(t[1]) == string::npos ||
       in.find(t[2]) == string::npos
    ){
      g++; continue;
    } else break;
  }
  for(int i=0; i<in.size(); i++){
    char t = in[i];
    if(t == ' ' || t == '.' || t == ',')
      cout << t;
    else
      cout << (char)(in[i]-g);
  }
  cout << endl;
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<sstream>
#include<vector>
using namespace std;
signed main(){
        char s[100];
        while( fgets(s, 100, stdin) != NULL ){
                vector<string> words;
                istringstream stream(s);
                string word;
                while(getline(stream, word, ' ')) words.push_back(word);
                int d;
                for(auto w: words){
                        if(w.length()==3 &&
                                        ((int)w[0] - (int)w[1] == (int)'t' - (int)'h') &&
                                        ((int)w[1] - (int)w[2] == (int)'h' - (int)'e')){
                                d = (int)w[0] -'t';
                                break;
                        }else if(w.length()==4 &&
                                        ((int)w[0] - (int)w[1] == (int)'t' - (int)'h') &&
                                        ((int)w[1] - (int)w[2] == (int)'h' - (int)'i') &&
                                        ((int)w[2] - (int)w[3] == (int)'i' - (int)'s')){
                                d = (int)w[0] -'t';
                                break;
                        }else if(w.length()==4 &&
                                        ((int)w[0] - (int)w[1] == (int)'t' - (int)'h') &&
                                        ((int)w[1] - (int)w[2] == (int)'h' - (int)'a') &&
                                        ((int)w[2] - (int)w[3] == (int)'a' - (int)'t')){
                                d = (int)w[0] -'t';
                                break;
                        }
                }
                for(unsigned int i=0; i<100 && s[i]!=0;i++){
                        char c=s[i];
                        if('a'<=c&&c<='z') printf("%c",(char)(c-d));
                        else printf("%c",c);
                }
        }
        return 0;
}

C++: #include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main(){
  string s;
  getline(cin,s);
  for(int i=1;i<26;i++){
    string ans;
    for(string::iterator it=s.begin();it!=s.end();it++){      
      if(*it==' '||*it=='.'){
	ans.push_back(*it);
	continue;
      }
      ans.push_back((char)(((int)*it-0x61+i)%26+0x61));
    }
    if(ans.find("the")!=string::npos||ans.find("this")!=string::npos||ans.find("that")!=string::npos){
      cout<<ans<<endl;
      break;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;

int main() {
	string sa;
	while (getline(cin, sa), sa != "END OF INPUT") {
		int a = sa.size();
		while (1) {
			for (int i = 0; i < a; i++) {
				if (sa[i] > 96 && sa[i] < 123) {
					sa[i] += 1;
				}
					if (sa[i] == 123){
						sa[i] -= 26;
					}				
			}
			size_t za=sa.find("this"||"that"||"the");
			if (za != string::npos) {
				break;
			}
		}
		cout << sa << endl;
	}
	return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	string s;
	while(getline(cin,s)){
		for (int i = 0; i < 26; i++)
		{
			for(int j = 0; j < (int)s.size(); j++){
				if('a' <= s[j] && s[j] <= 'z'){
					char c = (s[j] - 'a' + 1) % 26 + 'a';
					s[j] = c;
				}
			}

			if(s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos)
				break;
		}

		cout << s << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main()
{
	string s;
	int pl;
	while(getline(cin,s))
	{
		if(s=="\n" && s=="EOF") 
			break;

		pl = 0;

		for(int i =-30;i<30;i++)
		{
			for(int j = 0; j < s.size()-3; j++)
			{
				if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'e')
				{
					pl = i;
					break;
				}

				if(j==s.size()-1) 
					break;

				if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'a' && s[j+3]+i=='t')
				{
					pl = i;
					break;
				}

				if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'i' && s[j+3]+i=='s')
				{
					pl = i;
					break;
				}
			}

			if(pl!=0) 
				break;
		}

		for(int i=0;i <s.size();i++)
		{
			if(s[i] >= 'a' && s[i] <= 'z')
			{
				s[i] += pl;
				if(s[i] > 'z')
				{
					s[i] -= 'z' - 'a';
				}
			}
		}

		cout<<s<<endl;
	}
}

C++: #include<cstdio>

using namespace std;



char shiftch(char p, int n){
	int t;
	if('A'<= p && p <='Z'){
		p-='A';
		if(n<0) n+=26;
		p+=n;
		p%=26;
		p+='A';
		return p;
	}
	else if('a'<= p && p <='z'){
		p-='a';
		if(n<0) n+=26;
		p+=n;
		p%=26;
		p+='a';
		return p;
	}
	else return p;
}

int main(){

	int	i, j, n;
	char in[1000], *p, *tp;
	p= in;

	scanf("%[^\n]", in);
	for(n=0; 16<=in[n] && in[n]<=126; n++);

	while(1){
		tp=p;
		for(i=0; *(p++)!=' ';	i++);
		if(i==3||i==4){

			j=*tp-'t'; if(*(tp+1)=='h'+j) break;
			j=*tp-'T'; if(*(tp+1)=='h'+j){
			j+='a'-'A';
			break;
			}
		}
	}
	for(i=0; i<n; i++)	in[i]=shiftch(in[i],-j);

	printf("%s\n",in);

	return 0;
}

C++: #include<stdio.h>
#include<string.h>

int main(void){
	char data[100];
	char s1[]="the",
		 s2[]="this",
		 s3[]="that";
	int i,cnt=0;
	char *p;

	while((fgets(data,100,stdin))){
		while(cnt<=26){
			p=strstr(data,s1);
			if(p)
				break;
			p=strstr(data,s2);
			if(p)
				break;
			p=strstr(data,s3);
			if(p)
				break;
			for(i=0;i<100;i++){
				if(data[i]=='\0')
					break;
				if('a'<=data[i] && data[i]<='y')
					data[i]++;
				if('z'==data[i])
					data[i]='a';
			}
			cnt++;
		}
		cnt=0;
		printf("%s\n",data);
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cctype>

using namespace std;

string decStr(string str, int n) {
  for(int i = 0; i < str.length(); i++) {
    if(!isalpha(str[i])) continue;
    str[i] = (char)(  ((int)str[i]-(int)'a'+n)%26  + (int)'a'  );
  }
  return str;
}

int main(void) {
  string str;

  while(getline(cin, str)) {
    string ans;
    for(int i = 0; i < 26; i++) {
      ans = decStr(str, i);
      if(ans.find("the") != string::npos) break;
      if(ans.find("this") != string::npos) break;
      if(ans.find("that") != string::npos) break;
    }
    cout << ans << endl;
  }
  return 0;
}