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.h>
#include<stdio.h>

int main(){
	char s[100];

	int count = 0;

	gets(s);

	int diff;
	for (int j = 0; j < strlen(s); j++){
		diff = s[j] - 't';
		//printf("diff:%d\n", diff);
		if ((s[j+1] - diff)== 'h'){
			//printf("%c\n", s[j+1] - diff);
			if ((s[j+2] - diff) == 'e'){
				//printf("%c\n", s[j + 2] - diff);
				if (s[j+3] == ' '){
					break;
				}
			}
			else if ((s[j + 2] - diff) == 'a'){
				//printf("%c\n", s[j + 2] - diff);
				if ((s[j + 3] - diff) == 't'){
					//printf("%c\n", s[j + 3] - diff);
					if (s[j + 4] == ' '){
						break;
					}
				}
			}
			else if ((s[j + 2] - diff) == 'i'){
				//printf("%c\n", s[j + 2] - diff);
				if ((s[j + 3] - diff) == 's'){
					//printf("%c\n", s[j + 3] - diff);
					if (s[j + 4] == ' '){
						break;
					}
				}
			}

		}
	}

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

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

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
int word_search(vector<string> s,  string key){
	for(int i = 0; i < s.size(); i++){
		if(s[i].length() <= 2 || s[i].length() >= 6) continue;
		for(int j = 0; j < s[i].length() - 1; j++)
			if(s[i][j] == '.') continue;
		if(s[i][s[i].length() - 1] == '.') s[i].erase(s[i].end() - 1);
		for(int j = 0; j < 26; j++){
			string turned_word;
			for(int k = 0; k < s[i].length(); k++){
				turned_word.push_back((s[i][k] + j - 'a') % 26 + 'a');
			}
			if(turned_word == key) return j;
		}
	}
	return -1;
}
int main(){
	for(;;){
		char line[100];
		if(fgets(line, sizeof(line), stdin) == NULL) break;
		vector<string> s;
		char *token = strtok(line, " ");
		s.push_back(token);
		for(;;){
			token = strtok(NULL, " ");
			if(token == NULL) break;
			s.push_back(token);
		}
		int num;
		if(word_search(s, "the") != -1) num = word_search(s, "the");
		if(word_search(s, "this") != -1) num = word_search(s, "this");
		if(word_search(s, "that") != -1) num = word_search(s, "that");
		for(int i = 0; i < s.size(); i++){
			for(int j = 0; j < s[i].length(); j++){
				if(s[i][j] == '.') cout << '.';
				else if(s[i][j] == '\n') continue;
				else cout << (char)((s[i][j] + num - 'a') % 26 + 'a');
			}
			cout << ' ';
		}
		cout << endl;
	}
	return 0;
}

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

int main(void)
{
	char str[81];
	while(gets(str) != NULL)
	{
		int i,j;
		int len = strlen(str);
		for(i = 0;i < 26;i++)
		{
			for(j = 0;j < len;j++)
			{
				if(str[j] >= 'a' && str[j] <= 'z')
				{
					str[j] = (str[j] - 'a' + 1) % 26 + 'a';
				}
			}
			for(j = 0;j < len-2;j++)
			{
				if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'e')
				{
					puts(str);
					break;
				}
			}
			if(j != len-2)
				break;
			for(j = 0;j < len-3;j++)
			{
				if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'i' && str[j+3] == 's')
				{
					puts(str);
					break;
				}
			}
			if(j != len-3)
				break;
			for(j = 0;j < len-3;j++)
			{
				if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'a' && str[j+3] == 't')
				{
					puts(str);
					break;
				}
			}
			if(j != len-3)
				break;
		}
	}
}

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

int main(){
    string before;
    while (getline(cin, before)) {
        int swich = 0;
        for (int i = 0;i < 27 ;i++) {
            for (int j = 0; j < before.size(); j++) {
                if (before[j]>'z') {
                    before[j] = 'a';
                }
                else if (isalpha(before[j])) {
                    before[j]++;
                }
            }
            for (int j = 0; j < before.size(); j++) {
                if (before[j]=='t'&& before[j+1]=='h'&& before[j+2]=='e') {
                    if (before[j+3]==' '|| before[j+3]=='.'|| before[j+3] == '\n') {
                        swich = 1;
                        break;
                    }
                }
                else if (before[j]=='t'&&before[j+1]=='h'&&before[j+2]=='a'&&before[j+3]=='t') {
                    if (before[j+4]==' '||before[j+4]=='.'|| before[j+4] == '\n') {
                        swich = 1;
                        break;
                    }
                }
                else if (before[j]=='t'&&before[j+1]=='h'&&before[j+2]=='i'&&before[j+3]=='s') {
                    if (before[j+4]==' '||before[j+4]=='.'|| before[j+4] == '\n') {
                        swich = 1;
                        break;
                    }
                }
            }
            if (swich == 1) {
                break;
            }
        }
        cout << before << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>

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

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

int main() {
	string st;
	string w[3]={"the","this","that"};
	int wn[3]={3,4,4},k,i,j,s,f;
	while(getline(cin,st)) {
    k=0;
	while(true) {
		for (i=0;i<3;i++) {
			s=0; f=0;
			if (st.size()<k+wn[i]) break;
			for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
			if (s==wn[i]-1 && (st[k+wn[i]]<'a' || st[k+wn[i]]>'z')) { f=1; i=5; }
		}
		if (f==1) break;
		for(k;st[k]>='a' && st[k]<='z' ;k++);
		if (k>=st.size()) break;
		k++;
		}
	if (f==0) cout << st; else {
	for (i=0;i<st.size();i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
	}	
	cout << endl;
	}
    return 0;
	}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string S;
    while( getline( cin, S ) )
    {
        while( S.find( "the" ) != string::npos || S.find( "this" ) != string::npos || S.find( "that" ) != string::npos )
        {
            REP( i, (int)S.size() )
            {
                if( S[ i ] != ' ' && S[ i ] != '.' )
                {
                    if( S[ i ] == 'z' )
                    {
                        S[ i ] = 'a';
                        continue;
                    }
                    S[ i ]++;
                }
            }
        }
        cout << S << endl;
    }
    return 0;
}