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++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int caesar(string s)
{
	string s0 = "this";
	string s1 = "that";
	string s2 = "the";

	for (int i = 0; i <= 26; i++)
	{
		if (s == s0 || s == s1 || s == s2 || s == s0+"." || s == s1 + "." || s == s2 + ".")
		{
			return i;
		}
		for (int j = 0; j < 4; j++)
		{
			s0.at(j) = s0.at(j)++;
			if (s0.at(j) > 'z')
			{
				s0.at(j) = 'a';
			}
			s1.at(j) = s1.at(j)++;
			if (s1.at(j) > 'z')
			{
				s1.at(j) = 'a';
			}
		}
		for (int j = 0; j < 3; j++)
		{
			s2.at(j) = s2.at(j)++;
			if (s2.at(j) > 'z')
			{
				s2.at(j) = 'a';
			}
		}
	}

	return -1;
}

int main()
{
	string str;
	for (; getline(cin, str);)
	{
		stringstream ss;
		ss << str;

		vector<string> w;
		string s;
		int c = -1;
		for (; ss >> s;)
		{
			w.push_back(s);
			
			if (c == -1)
			{
				c = caesar(s);
			}
		}

		for (int i = 0; i < w.size(); i++)
		{
			for (int j = 0; j < w.at(i).size(); j++)
			{
				if (w.at(i).at(j) != '.')
				{
					char sp = w.at(i).at(j) - c;
					if (sp < 'a')
					{
						int p = 'a' - sp - 1;
						w.at(i).at(j) = 'z' - p;
					}
					else
					{
						w.at(i).at(j) = sp;
					}
				}			
			}

			cout << w.at(i) << (i == w.size() - 1 ? "" : " ");
		}

		cout << endl;
	}
}

C++: #include <stdio.h>
#include <string.h>
int main()
{    char line[1000];
     int len,i;
    while(gets(line)){
         len=strlen(line);

         for(i=0;i<len;i++){
            if(line[i]>='a' && line[i]<='z'){
                if(line[i]=='a')printf("w");
                else if(line[i]=='b')printf("x");
                else  if(line[i]=='c')printf("y");
                else if(line[i]=='d')printf("z");
                else printf("%c",line[i]-4);}
                else printf("%c",line[i]);
}
printf("\n");

}

return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

string caesar(string s, int n){
    string res = s;
    rep(i, 0, s.size()){
        if('a' <= s[i] && s[i] <= 'z'){
            if(s[i] - 'a' + n < 26){
                res[i] += n;
            }else{
                res[i] += n - 26;
            }
        }
    }
    return res;
}

bool find(string s, string t){
    return s.find(t) != string::npos;
}

signed main(){
    string s;
    string str[3] = {"the", "this", "that"};
    while(getline(cin, s)){
        string t;
        bool f = false;
        rep(i, 0, 26){
            t = caesar(s, i);
            // cout << t << endl;
            rep(j, 0, 3){
                if(find(t, str[j])){
                    f = true;
                    i = 26;
                    break;
                }
            }
        }
        cout << t << endl;
    }
}

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

bool decision(string input){
	for(int i = 0; i < input.size()-3; i++){
		if((input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'e') ||
			(input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'i' && input[i+3] == 's') ||
			(input[i] == 't' && input[i+1] == 'h' && input[i+2] == 'a' && input[i+3] == 't')){
			return true;
		}
	}
	return false;

}

int main(){
	string input;
	getline(cin, input);

	while(1){
		for(int i = 0; i < input.size(); i++){
			if('a' <= input[i] && input[i] <= 'z'){
				if(input[i] != 'z'){
					input[i] += 1;
				}else{
					input[i] = 'a';
				}
			}
		}
		if(decision(input)) break;
	}

	cout << input << endl;
	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<stdio.h>

int main(){

	char s[100];
	while (gets(s)){
		
		int diff;
		int flag = false;
		//一番最初に｛the,that,this｝がある場合
		diff = s[0] - 't';
		if ((s[1] - diff) == 'h'){
			//printf("%c\n", s[j+1] - diff);
			if ((s[2] - diff) == 'e'){
				//printf("%c\n", s[j + 2] - diff);
				if (s[3] == ' '){
					flag = true;
				}
			}
			else if ((s[2] - diff) == 'a'){
				//printf("%c\n", s[j + 2] - diff);
				if ((s[3] - diff) == 't'){
					//printf("%c\n", s[j + 3] - diff);
					if (s[4] == ' '){
						flag = true;
					}
				}
			}
			else if ((s[2] - diff) == 'i'){
				//printf("%c\n", s[j + 2] - diff);
				if ((s[3] - diff) == 's'){
					//printf("%c\n", s[j + 3] - diff);
					if (s[4] == ' '){
						flag = true;
					}
				}
			}
		}

		if (!flag){
			//一番以降に｛the,that,this｝がある場合
			for (int j = 1; j < strlen(s); j++){
				if ((s[j]) == ' '){
					diff = s[j + 1] - 't';
					if ((s[j + 1] - diff) == 't'){
						//printf("diff:%d\n", diff);
						if ((s[j + 2] - diff) == 'h'){
							//printf("%c\n", s[j+1] - diff);
							if ((s[j + 3] - diff) == 'e'){
								//printf("%c\n", s[j + 2] - diff);
								if (s[j + 4] == ' '){
									break;
								}
							}
							else if ((s[j + 3] - diff) == 'a'){
								//printf("%c\n", s[j + 2] - diff);
								if ((s[j + 4] - diff) == 't'){
									//printf("%c\n", s[j + 3] - diff);
									if (s[j + 5] == ' '){
										break;
									}
								}
							}
							else if ((s[j + 3] - diff) == 'i'){
								//printf("%c\n", s[j + 2] - diff);
								if ((s[j + 4] - diff) == 's'){
									//printf("%c\n", s[j + 3] - diff);
									if (s[j + 5] == ' '){
										break;
									}
								}
							}

						}
					}
				}
			}
		}
		//printf("diff:%d\n",diff);
		for (int i = 0; i < strlen(s); i++){
			if (s[i] == ' ' || s[i] == '.')continue;
			s[i] -= diff;
		}
		//s[strlen(s) - 1] = '\n';
		printf("%s\n", s);
	}
	return 0;