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 stro, str;
  while(getline(cin, stro)){
    for(int i = 1; i < 26; i++){
      str = stro;
      for(int j = 0; j < stro.length(); j++){
	if(str[j] != ' ' && str[j] != '.' && str[j] != '\n')
	  if(str[j] + i > 'z')
	    str[j] += i - 26;
	  else
	    str[j] += i;
      }
	if(str.find("the ", 0) != string::npos || str.find("this ", 0) != string::npos || str.find("that ", 0) != string::npos)
	  cout << str << endl;	
    }
  }
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>

using namespace std;


int main(){
	string line;

	while(getline(cin, line)){
		int flag;

		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<line.size() ; j++){
				if(line[j] != ' ' && line[j] != '.'){
					if(line[j] == 'a'){
						line[j] = 'z' ;
					}else{
						line[j]--;
					}
				}
			}

			for(int k=0 ; k<line.size()-1 ; k++){
				if(line[k] == 't' && line[k+1] == 'h'){
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}
		cout << line << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#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[200];
		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 <bits/stdc++.h>
#include <vector>
using namespace std;
string str;	
int a, b, c, d;
int main(){
	while(getline(cin, str)){
		a = str.length();
		for(int i = 0; i < a; i++){
			if(str[i] < 97 || str[i] > 122){
				cout << str[i];
			}
			else {
				b = (int)str[i];
				b = b - 4;
				if(b < 97)
					b = b + 26;
				cout << (char)b;
			}
		}
	}
	return 0;
}

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

int division(int a, int b)
{
    int res = a % b;
    return (res >= 0) ? res : b + a;
}

int attack(string line)
{
    static const string cmp[] = {"the", "this", "that"};
    istringstream iss(line);

    for (string word; iss >> word;) {
        char first = word[0];
        for (string c: cmp) {
            int i = 1;
            for (; i < c.size() && i < word.size(); i++)
                if (division(c[i] - 't', 26) != division(word[i] - first, 26))
                    break;
            if (i == c.size())
                return division('t' - first, 26);
        }
    }

    return 0;
}

inline int rotN(int x, int n)
{
    if (isalpha(x))
        return (x - 'a' + n) % 26 + 'a';
    else
        return x;
}

int main()
{
    int rot;
    string line;

    while (getline(cin, line)) {

        rot = attack(line);

        for (auto x : line)
            cout << (char) rotN(x, rot);

        cout << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main()
{
	string str,t;
	while(getline(cin,str))
	{
		for(int i = 1;i < 26;++i)
		{
			t = str;
			for(int j = 0;j < str.size();++j)
			{
				if(t[j] == ' ' || t[j] == '.') continue;
				t[j] = (t[j] - 'a' + i) % 26 + 'a';
			}
			if(t.find("that",0) != string::npos && t.find("this",0) != string::npos && t.find("the",0) != string::npos){
				cout << t << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>

using namespace std;

int main()
{

//	cut here before submit 
//	freopen("testcase.cc", "r", stdin);
	const string key[] = { "the", "this", "that" };

	string str = "";
	
	while (getline (cin, str )){
		int len = str.length();
		int i,j;
		vector <bool> match (3, false);

		for (j = 0; j < 26; ++j){
			string curr = str;
			for (i = 0; i < len; ++i){
				if ( isalpha(str[i]) ){
					curr[i] = (str[i] - 'a' + j) % 26 + 'a';
				} // end if
			} // end for

			for (i = 0; i < 3; ++i){
				if ( curr.find(key[i]) != string::npos ){
					match[i] = true;
				} // end if
			} // end for
			if ((int)count(match.begin(), match.end(), true ) > 0){
				cout << curr << endl;
				break;
			} // end if
		} // end for
	} // end while
		
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
int main(){std::string s;while(std::getline(std::cin,s)){char b[81],*p,*c;c=b;strcpy(b,s.c_str());int gap=0;do{p=strtok(c," .\n");if(p!=NULL){int l=strlen(p);if(l>=3&&p[0]-p[1]=='t'-'h'){if(l==3){if(p[0]-p[2]=='t'-'e'){gap='t'-p[0];}}else if(l==4){if(p[0]-p[2]=='t'-'i'&&p[0]-p[3]=='t'-'s'||p[0]-p[2]=='t'-'a'&&p[0]-p[3]==0){gap='t'-p[0];break;}}}}c=NULL;}while(p!=NULL);for(std::string::iterator it=s.begin();it!=s.end();++it){if(*it!=' '&&*it!='.'&&*it!='\n'){std::cout<<static_cast<char>(*it+gap);}else{std::cout<<*it;}}puts("");}}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>

using namespace std;


int main(){
	string line;

	while(getline(cin, line)){
		int flag;

		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<line.size() ; j++){
				if(line[j] != ' ' && line[j] != '.'){
					if((line[j]-1) < 'a'){
						line[j] = line[j] +1 -'a' + 'z' ;
					}else{
						line[j]--;
					}
				}
			}

			for(int k=0 ; k<line.size() ; k++){
				if(line[k] == 'h' && line[k-1] == 't'){
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}
		cout << line << endl;
	}
	return 0;
}