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 a = "";
	while (getline(cin, a)) {
		a += " ";
		string b = "";
		int z = 0, sum = 0;
		int k = a.length();
		for (int i = 0; i <k; i++) {
			if (a[i] == ' ' || a[i] == '.') {
				b = a.substr(z, i - z);
				int t = (int)'t';
				string c = "";
				if (b.length() == 3 || b.length() == 4) {
					c = "";
					int w = t - (int)b[0];
					for (int i = 0; i < b.length(); i++) {
						int d = (char)((int)b[i] + w);
						if (d > 'z')
							d -= 26;
						else if (d < 'a')
							d += 26;
						c += (char)d;
					}
					if (c == "the" || c == "that" || c == "this") {
						sum = w;
						break;
					}
				}
				z = i + 1;
			}
		}
		string f = "";

		for (int i = 0; i < k-1; i++) {
			if (a[i] != ' ' && a[i] != '.' ) {
				int g = (int)a[i] + sum;
				if (g >(int)'z')
					g -= 26;
				else if (g < (int)'a')
					g += 26;
				f += (char)g;
			}
			else {
				f += a[i];
			}
		}
		cout << f << endl;
	}
}

C++: #include <cstdio>
#include <string.h>
using namespace std;

char str[128] = { 0 };

inline char nxt(char c) {
	if (c == 'z') {
		c = 'a';
	}
	else if (c >= 'a' && c < 'z') {
		c++;
	}
	return c;
}

bool find() {
	int p = 0;
	while (str[p] != '\0') {
		if (str[p] == 't' && str[p + 1] == 'h') {
			if (str[p + 2] == 'e') {
				return true;
			}
			else if (str[p + 2] == 'i' && str[p + 3] == 's') {
				return true;
			}
			else if (str[p + 2] == 'a' && str[p + 3] == 't') {
				return true;
			}
		}
		p++;
	}
	return false;
}

int main(){
	while (fgets(str, sizeof(str), stdin) != NULL) {
		str[strlen(str) - 1] = '\0';
		for (int i = 0; i < 25; i++) {
			int p = 0;
			while (str[p] != '\0') {
				str[p] = nxt(str[p]);
				p++;
			}
			if (find()) {
				printf("%s", str);
				break;
			}
		}
	}


	return 0;
}

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

int main(){
	string str;
	while(1){
		getline( cin, str );
		if( str.length()==0 )	break;
		for( int i=0; i<=26; i++ ){
			for( int j=0; j<str.length(); j++ ){
				if( 'a'<=str[j] && str[j]<='z' ){
					str[j]++;
					if( str[j] == 'z'+1 )
						str[j] = 'a';
				}
			}
			if( str.find("the")+str.find("this")+str.find("that") != -3 ){
				cout << str << endl;
				break;
			}
		}
	}
	return 0;
}

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

char name[] = {
	'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
	'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
	'u', 'v', 'w', 'x', 'y', 'z', '.'
};

int index(char c){
	if(c == '.') return 26;
	return ((int)c - 97);
}

char change(char c, int i){
	if(c == '.') return '.';
	if(c == ' ') return ' ';
	return name[(index(c) + i) % 26];
}

char rchange(char c, int i){
	if(c == '.') return '.';
	if(c == ' ') return ' ';
	return name[(index(c) + 26 - i) % 26];
}

bool search(string s, const string& t, int i){
	string t2;
	for(string::const_iterator iter = t.begin();
		iter != t.end(); iter++)
	{
		t2.push_back(rchange(*iter,i));
	}
	string::const_iterator it = search(s.begin(), s.end(), t2.begin(), t2.end());
	if(it != s.end()){
		if(it == s.begin() || it[-1] == ' ')
			if(it + t2.size() == s.end() || (it[t2.size()] == ' ' || it[t2.size()]))
				return true;
	}
	return false;
}

int main(){
	string s;
	const string t1("the"), t2("this"), t3("that");
	while(getline(cin, s)){
		int i = 0;
		for(; i < 26; i++){
			if(search(s, t1,i) || search(s, t2, i) || search(s, t3, i))
				break;
		}
		for(string::const_iterator it = s.begin();
			it != s.end(); it++)
		{
			cout << change(*it, i);
		}
		cout << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,maxe=0,co=0;;
    char str[82][82];
    for(int i=0;;i++){
        if(cin>>str[i]){

        }
        else break;
    }
    for(int i=1;;i++){
        for(int j=0;j<maxe;j++){
            if(str[j][0]-i=='t'){
                if(str[j][1]-i=='h'&&str[j][2]-i=='i'&&str[j][3]-i=='s'||str[j][1]-i=='h'&&str[j][2]=='e'||str[j][1]-i=='h'&&str[j][2]-i=='a'&&str[j][3]=='t'){
                    co=i;
                    break;
                }
            }
        }
        if(co!=0)break;
    }
    for(int i=0;i<maxe;i++){
        for(int j=0;str[i][j]!='\0';j++){
                if(str[i][j]!='.')printf("%c",str[i][j]-co);
                else cout<<".";
        }
        if(i!=maxe-1)cout<<" ";
        else cout<<endl;
    }


}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[53]="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
int main(){
    char str[82];
    while(cin>>str[0]){
        for(int i=1;i<82;i++)str[i]=0;
        for(int i=1;i<80;i++){
            str[i]=getchar();
            if(str[i]==10)break;
        }
        int len=strlen(str);

        for(int i=0;i<=26;i++){
            char cpy[82];
            strncpy(cpy,str,82);

            for(int j=0;j<len;j++){
                if(str[j]==' ' || str[j]=='.' || str[j]==10)continue;
                cpy[j]=a[cpy[j]-'a'+i];
            }
            bool f=false;
            for(int j=0;j<len-3;j++){
                if(!strncmp(cpy+j,"the",3))f=true;
                if(!strncmp(cpy+j,"this",4))f=true;
                if(!strncmp(cpy+j,"that",4))f=true;
            }
            if(f){
                cout<<cpy<<endl;
                break;
            }
        }
    }
    return 0;


}

C++: #include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
	char t[27][27] = {"bcdefghijklmnopqrstuvwxyza", "cdefghijklmnopqrstuvwxyzab", "defghijklmnopqrstuvwxyzabc",
		"efghijklmnopqrstuvwxyzabcd", "fghijklmnopqrstuvwxyzabcde", "ghijklmnopqrstuvwxyzabcdef",
		"hijklmnopqrstuvwxyzabcdefg", "ijklmnopqrstuvwxyzabcdefgh", "jklmnopqrstuvwxyzabcdefghi",
		"klmnopqrstuvwxyzabcdefghij", "lmnopqrstuvwxyzabcdefghijk", "mnopqrstuvwxyzabcdefghijkl",
		"nopqrstuvwxyzabcdefghijklm", "opqrstuvwxyzabcdefghijklmn", "pqrstuvwxyzabcdefghijklmno",
		"qrstuvwxyzabcdefghijklmnop", "rstuvwxyzabcdefghijklmnopq", "stuvwxyzabcdefghijklmnopqr",
		"tuvwxyzabcdefghijklmnopqrs", "uvwxyzabcdefghijklmnopqrst", "vwxyzabcdefghijklmnopqrstu",
		"wxyzabcdefghijklmnopqrstuv", "xyzabcdefghijklmnopqrstuvw", "yzabcdefghijklmnopqrstuvwx",
		"zabcdefghijklmnopqrstuvwxy"};
	char s[81], r[81];
	string u;
	int i, j;
	while (1)
	{
		cin.getline(s, sizeof(s));
		if (cin.eof()) break;
		for (i = 0; i < 27; i++)
		{
			for (j = 0; j < strlen(s); j++)
			{
				if ('a' <= s[j] && s[j] <= 'z')
					r[j] = t[i][(int)(s[j]-'a')];
				else
					r[j] = s[j];
			}
			r[strlen(s)] = '\0';
			u = r;
			if (u.find("the") != string::npos || u.find("this") != string::npos || u.find("that") != string::npos)
			{
				cout << u << endl;
				break;
			}
		}
	}
}