Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

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 {
		infos := strings.Split(nextString(), " ")
		plain := make([]string, len(infos))
		if len(infos) == 0 {
			break
		}
		// 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 <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	
	string s;
	while(getline(cin,s)){
		string str[26];
		int num;
		for(int i=0;i<26;i++){
			str[i] = s;
			for(int j=0;j<str[i].size();j++){
				for(int k=0;k<i;k++){
					if(str[i][j]=='.' || str[i][j]==' '){
						continue;
					}
					if(str[i][j] == 'a'){
						str[i][j] = 'z';
					}
					str[i][j]--; 
				}
			}
			
			for(int j=0;j<str[i].size();j++){
				string str_temp, str_temp2;	
				if(j <= str[i].size()-3){
					str_temp  = str[i].substr(j,3);
				}
				if(j <= str[i].size()-4){
					str_temp2 = str[i].substr(j,4);
				}
				if(str_temp=="the" || str_temp2=="this" || str_temp2=="that"){
					num = i;
				}
			}
		}
		
		
		cout<< str[num]<< endl;
	}		
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include <iostream>
#include <string>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

string Caesar(string str, int shift){
    string ret="";
    REP(i, str.size()){
        if('a'<=str[i] && str[i]<='z') ret += (str[i] - 'a' + shift) % 26 + 'a';
        else ret+=str[i];
    }
    return ret;
}

int main(){
	string str;
	getline(cin, str, '\n');
	REP(i, 26){
		string fix = Caesar(str, i);
    	if( fix.find( "the", 0 ) != string::npos ||
    		fix.find( "this", 0 ) != string::npos ||
    		fix.find( "that", 0 ) != string::npos ){
			cout<<fix<<endl;
			break;
		}
	}
	return 0;
}

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

int main(void)
{
    list<string> input;
    int dec = 0;
    string s;
    while (cin >> s)
    {
        input.push_back(s);

        if (dec == 0)
        {
            int d;
            d = s[0] - 't';

            string t = "";
            for (int i = 0; i < s.length(); i++)
                t += s[i] - d;

            if (t == "the" || t == "this" || t == "that")
                dec = d;
        }
    }
    int n = 0;
    for (list<string>::iterator i = input.begin(); i != input.end(); i++)
    {
        n++;
        string out = *i;
        for (int j = 0; j < out.length(); j++)
        {
            if (out[j] != '.')
            {
                cout << (char)(out[j] - dec);
            }
            else
            {
                cout << '.';
            }
        }
        if(n < input.size()){
            cout << ' ';
        }
    }

    cout << endl;
    return 0;
}

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

int main(){
	string str[100];
	int k = 0;
	int zure[100];
	bool flag[100] = {false};
	while(getline(cin, str[k])){
		for(int j = 0; j < 26; j++){
			for(int i = 0; i < str[k].size()-2; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'e'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			for(int i = 0; i < str[k].size()-3; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'i'+j && str[k][i+3] == 's'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			for(int i = 0; i < str[k].size()-3; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'a'+j && str[k][i+3] == 't'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			k++;
		}
	}
	for(int j = 0; j < k; j++){
		for(int i = 0; i < str[j].size(); i++){
			if(str[j][i] >= 'a' && str[j][i] <= 'z'){
				str[j][i] = str[j][i]-zure[j];
				if(str[j][i] < 'a'){
					str[j][i] = str[j][i]+26;
				}
			}
		}
		cout << str[j] << endl;
	}
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


int main()
{
	string a;

	while (getline(cin, a), cin){
		vector<string> aa;

		auto left = a.begin();

		while (true){
			auto right = left;
			while (right != a.end() && *right != ' ')++right;

			aa.emplace_back(left, right);
			if (right == a.end())
				break;

			left = right + 1;
		}


		string c[3] = { "this", "that", "the" };

		vector<string> nn;
		vector<string> kk;
		for (auto x : aa){
			auto n = x.length();
			if (n == 3){
				kk.push_back(x);
			}
			if (n == 4){
				nn.push_back(x);
			}
		}

		for (auto x : kk){
			auto n1 = x[0] - c[2][0];
			bool f(true);

			for (int i = 1; i < 3; ++i){
				if (n1 != x[i] - c[2][i])
					f = false;
			}

			if (f){
				int i(0);
				for (auto x : aa){
					for (auto y : x){

						if ('a' > y || 'z' < y){
							std::cout << y;
							continue;
						}

						int q = y - 'a';
						if (q - n1 < 0){
							q = 26 - n1;
						}
						else
							q -= n1;

						std::cout << (char)(q + 'a');
					}
					if (i < aa.size() - 1)
						std::cout << " ";
					++i;
				}
				std::cout << endl;
				goto END;
			}
		}

		for (auto x : nn){
			auto n1 = x[0] - c[0][0];
			auto n2 = x[0] - c[1][0];
			bool f(true);
			bool f2(true);

			for (int i = 1; i < 4; ++i){
				if (n1 != x[i] - c[0][i])
					f = false;
				if (n2 != x[i] - c[1][i])
					f2 = false;
			}

			if (f){
				int i(0);
				for (auto x : aa){
					for (auto y : x){
						if ('a' > y || 'z' < y){
							std::cout << y;
							continue;
						}

						int q = y - 'a';
						if (q - n1 < 0){
							q = 26 - n1;
						}
						else
							q -= n1;

						std::cout << (char)(q + 'a');
					}
					if (i < aa.size() - 1)
						std::cout << " ";
					++i;
				}
				std::cout << endl;
				goto END;
			}
			else if (f2){
				int i(0);
				for (auto x : aa){
					for (auto y : x){
						if ('a' > y || 'z' < y){
							std::cout << y;
							continue;
						}

						int q = y - 'a';
						if (q - n2 < 0){
							q = 26 - n2;
						}
						else
							q -= n2;

						std::cout << (char)(q + 'a');
					}
					if (i < aa.size() - 1)
						std::cout << " ";
					++i;
				}
				std::cout << endl;
				goto END;
			}

		}
	END:;
	}
	return 0;
}