Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func cipher(text string, direction int, int_shift int) string {
	shift, offset := rune(int_shift), rune(26)
	runes := []rune(text)
	for index, char := range runes {
		switch direction {
		case 1:
			if char >= 'a' && char <= 'z'-shift || char >= 'A' && char <= 'Z'-shift {
				char = char + shift
			} else if char > 'z'-shift && char <= 'z' || char > 'Z'-shift && char <= 'Z' {
				char = char + shift - offset
			}
		case -1:
			if char >= 'a'+shift && char <= 'z' || char >= 'A'+shift && char <= 'Z' {
				char = char - shift
			} else if char >= 'a' && char < 'a'+shift || char >= 'A' && char < 'A'+shift {
				char = char - shift + offset
			}
		}
		runes[index] = char
	}
	return string(runes)
}

func main() {
	for scanner.Scan() {
		infos := strings.Split(scanner.Text(), " ")
		plain := make([]string, len(infos))
		// fmt.Println(infos)
		Decryption:
			for i := 0; i < 26; i++ {
				for j := range infos {
					plain[j] = cipher(infos[j], 1, i)
				}
				for j := range plain {
					if plain[j] == "this" || plain[j] == "that" || plain[j] == "the" {
						break Decryption
					}
				}
			}
			fmt.Println(strings.Join(plain, " "))
	}
}

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;
}