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>
#include <vector>

using namespace std;

int main()
{
    vector<string> str;
    string input;
    int num[81];
    int slide = 0;
    const int al_num = 26;
    string s_the[al_num];
    string s_this[al_num];
    string s_that[al_num];    

    for (int i = 0; i < al_num; i++) {
        s_the[i].push_back(('t' + i - 'a') % al_num + 'a');
        s_the[i].push_back(('h' + i - 'a') % al_num + 'a');
        s_the[i].push_back(('e' + i - 'a') % al_num + 'a');
    }
    cout << endl;
    for (int i = 0; i < al_num; i++) {
        s_this[i].push_back(('t' + i - 'a') % al_num + 'a');
        s_this[i].push_back(('h' + i - 'a') % al_num + 'a');
        s_this[i].push_back(('i' + i - 'a') % al_num + 'a');
        s_this[i].push_back(('s' + i - 'a') % al_num + 'a');
    }
    for (int i = 0; i < al_num; i++) {
        s_that[i].push_back(('t' + i - 'a') % al_num + 'a');
        s_that[i].push_back(('h' + i - 'a') % al_num + 'a');
        s_that[i].push_back(('a' + i - 'a') % al_num + 'a');
        s_that[i].push_back(('t' + i - 'a') % al_num + 'a');
    }

    for (int i = 0; i < al_num; i++)
        num[i] = -1;

    int i = 0;
    while (cin >> input) {
        num[i++] = input.size();
        str.push_back(input);
    }
    str[i - 1].erase(str[i - 1].size() - 1);
    num[i - 1]--;

    bool loop = false;
    for (int i = 0; num[i] != -1; i++) {
         if (num[i] == 3) { // "the"
             for (int j = 0; j < al_num; j++) {
                if (str[i] == s_the[j]) {
                    slide = j;
                    loop = true;
                    break;
                }
            }
        }
        else if (num[i] == 4) { // "this", "that"
            for (int j = 0; j < al_num; j++) {
                if (str[i] == s_this[j] || str[i] == s_that[j]) {
                    slide = j;
                    loop = true;
                    break;
                }
            }
        }
        
        if (loop)
            break;
    }
    
    // output
    for (int i = 0; num[i] != -1; i++) {
        for (int j = 0; j < num[i]; j++) {
            char c;
            if (str[i][j] - slide < 'a')
                c = 'z' - ('a' - 1 - (str[i][j] - slide));
            else
                c = (str[i][j] - slide - 'a') % al_num + 'a';
            cout << c;
        }
        cout << ' ';
    }
    cout << '\b' << '.' << endl;

    return 0;
}

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

vs split(const string &text, char delim=' '){
	int p1 = 0, p2 = 0;
	vs tokens;

	for (int i=0; i<(int)text.size(); i++)
		if (text[i] == delim){
			p2 = i;
			tokens.push_back(text.substr(p1, p2 - p1));
			p1 = p2 + 1;
		}
	tokens.push_back(text.substr(p1));
	return tokens;
}

int rot(string &text){
	for (int i=0; i<(int)text.size(); i++){
		char c=text[i];
		if (islower(c))
			if (c=='z') text[i]='a';
			else text[i]++;
	}
	return 0;
}

bool check(string text){
	vs words = split(text);
	for (int i=0; i<(int)words.size(); i++){
		string s = words[i];
		if (s=="the" || s=="this" || s=="that")
			return true;
	}
	return false;
}

int main(void){
	string s;
	while (true){
		getline(cin, s);
		if (cin.eof()) break;
		for (int i=0; i<26; i++)
			if (check(s)) break;
			else rot(s);
		cout<<s<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  string str;
  while (getline(cin, str)) {
    for (int i = 0; i < 26; ++i) {
      for (char& c : str) {
        if (isalpha(c)) {
          if (c != 'z') ++c;
          else c = 'a';
        }
      }
      if (str.find("that") != string::npos || str.find("this") != string::npos || str.find("the") != string::npos) {
        cout << str << endl;
      }
    }
  }
}

C++: #include<cstdio>
#include<iostream>
#include<cstring>

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 checkch(char p){
	if('A'<= p && p <='Z') return 2;
	else if('a'<= p && p <='z') return 1;
	else return 0;
}
*/

int main(){

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

	scanf("%[^\n]", in);
	n= strlen(in);
//	printf("%d\n", 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;
			}
		}
//		++p;
	}
	for(i=0; i<n; i++)	in[i]=shiftch(in[i],-j);

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

	
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <stdlib.h>
#define substr(source,a,b,destination) destination="";for(int i=a;i<b;i++)destination+=source[i]
using namespace std;

int main(void){
	string str;

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