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<algorithm>
#include<string>

using namespace std;

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

		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]<='z' && s[i]>='a') s[i] += pl;
		}

		cout<<s<<endl;
		pl=0;
	}
}

C++: #include<cstdio>
#include<cctype>
#include<cstring>
char str[1000000] = {0};
using namespace std;
int main(){
    int f = 0;
    while(scanf("%[^\n]",str)!=EOF){
        fflush(stdin);
        for(int i = 0;i <= 25; i++){
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == ' ' || str[j] == '.')continue;
                str[j]++;
                if(str[j] > 122)str[j] = str[j]-26;
            }
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'e')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'i' && str[j+3] == 's')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'a' && str[j+3] == 't')goto hoge;
            }
        }
        for(int i = 0;i < strlen(str); i++){
            if(str[i] == ' ' || str[i] == '.')continue;
            str[i] -= 25;
        }
        for(int i = 0;i <= 25; i++){
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == ' ' || str[j] == '.')continue;
                str[j]--;
                if(str[j] < 97)str[j] = str[j]+25;
            }
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'e')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'i' && str[j+3] == 's')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'a' && str[j+3] == 't')goto hoge;
            }
        }
        hoge:
        printf("%s\n",str);
        memset(str,0,sizeof(str));
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
using namespace std;
string caesar(string str,int num){
	string ret;
	char c;
	for(int i=0;i<str.size();i++){
		c=str[i]+(num-26);
		if(c<'a') c+=26;
		ret+=(char)c;
	}
	return ret;
}

char caesarc(char c,int num){
	c+=(num-26);
	if(c<'a') c+=26;
	return c;
}

int main(){
	string str,sts;
	vector<string> ary;
	getline(cin,str);
	bool hog[3];
	string tes[3];
	int j;
	for(int i=0;i<26;i++){
		hog[0]=hog[1]=hog[2]=false;
		sts="";
		j=0;
		tes[0]=caesar("this",i);
		tes[1]=caesar("that",i);
		tes[2]=caesar("the",i);
		while(j<str.size()){
			sts="";
			while(str[j]!=' '&&str[j]!='.'){
				sts+=str[j];
				j++;
			}
			for(int k=0;k<3;k++){
				if(tes[k]==sts) hog[k]=true;
			}
			j++;
		}
		if(hog[0]&&hog[1]&&hog[2]){
			for(int k=0;k<str.size();k++){
				if('a'<=str[k]&&str[k]<='z'){
					cout<<caesarc(str[k],26-i);
				}
				else cout<<str[k];
			}
			cout<<endl;
			break;
		}
	}
	return 0;
}

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

int main(){
    
    int zure;
    string str,the,thi,tha;
    
    the = "the";
    thi = "this";
    tha = "that";
    while(getline(cin,str)){
        for(int i=0;i<26;i++){
            
            for(int j=0;j<4;j++){
            
                if(j < 3) the[j] = 'a'+(the[j]-'a'+1)%26;
                thi[j] = 'a'+(thi[j]-'a'+1)%26;
                tha[j] = 'a'+(tha[j]-'a'+1)%26;
            
                if(str.find(the) != string::npos || str.find(thi) != string::npos || str.find(tha) != string::npos){
                    zure = (the[0]-'t'+26)%26;
                }
            
            }
        
        }
    
        for(int i=0;i<str.size();i++){
            if('a' <= str[i] && str[i] <= 'z'){
                str[i] = str[i]-zure;
                if(str[i] < 'a') str[i] += 26;
            }
        }
        cout << str << endl;
    }
    return(0);
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
char rec(char x,int s){
  if(x-s<'a')return x-s+26;
  return x-s;
}
int main(){
  string s[80];
  int k=0,l=0;
  while(cin>>s[k]){
    int y=s[k][0]-'t';
    if(s[k].size()==3){
      if(rec(s[k][1],y)=='h'&&rec(s[k][2],y)=='e')l=y;
    }
    if(s[k].size()==4){
      if(rec(s[k][1],y)=='h'&&rec(s[k][2],y)=='a'&&rec(s[k][3],y)=='t')l=y;
      else if(rec(s[k][1],y)=='h'&&rec(s[k][2],y)=='i'&&rec(s[k][3],y)=='t')l=y;
    }
    k++;
  }
  for(int i=0;i<k;i++){
    for(int j=0;j<s[i].size();j++){
      if(s[i][j]=='.')cout<<'.';
      else cout<<rec(s[i][j],l);
    }
    if(i==k-1)cout<<endl;
    else cout<<" ";
  }
}