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 <istream>
#include <cstring>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	char a[82], b[82], t;
	
	while(cin.getline(a, 82, '\n')){
		n = strlen(a);
		for(int i = 0, f = 0; i < 26; i++){
			for(int j = 0; j < n; j++){
				if(a[j] == ' ' || a[j] == ',' || a[j] == '.'){
					b[j] = a[j];
				} else {
					t = a[j] - i;
					if(t < 'a'){
						t += 25;
					} else if(t > 'z'){
						t -= 25;
					}
					b[j] = t;
				}
			}
			
			for(int j = 0; j < n; j++){
				if(b[j] == 't' && j == 0 && b[j+1] == 'h'){
					if(b[j+2] == 'e' && b[j+3] == ' '){
						f = 1;
						break;
					} else if(b[j+2] == 'a' && b[j+3] == 't' && b[j+4] == ' '){
						f = 1;
						break;
					} else if(b[j+2] == 'i' && b[j+3] == 's' && b[j+4] == ' '){
						f = 1;
						break;
					}
				} else if(b[j] == ' ' && b[j+1] == 't' && b[j+2] == 'h'){
					if(a[j+3] == 'e' && a[j+4] == ' '){
						f = 1;
						break;
					} else if(b[j+3] == 'a' && b[j+4] == 't' && b[j+5] == ' '){
						f = 1;
						break;
					} else if(b[j+3] == 'i' && b[j+4] == 's' && b[j+5] == ' '){
						f = 1;
						break;
					}
				}
			}
			if(f == 1){
				printf("%s\n", b);
				break;
			}
		}
	}
	
	return 0;
}

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

// determine whether it is "the","this" or "that"
char is_article(string w) {
	if (w == "the" || w == "this" || w == "that") {
		return '\0';
	}
	char sh = 't' - w.front();
	for_each(w.begin(),w.end(),[sh](char &c) {
		c += sh;
		if (c > 'z') {
			c -= 'z'-'a'+1;
		} else if (c < 'a') {
			c += 'z'-'a'+1;
		}
	});
	if (w != "the" && w != "this" && w != "that") {
		sh = '\0';
	}
	return sh;
}

int main() {
	string s;
	while (getline(cin,s)) {
		istringstream stream(s);
		string w;
		char sh;
		while (stream >> w) {
			if ((sh = is_article(w)) != '\0') {
				break;
			}
		}
		for_each(s.begin(),s.end(),[sh](char &c) {
			if (c >= 'a' && c <= 'z') {
				c += sh;
				if (c > 'z') {
					c -= 'z'-'a'+1;
				} else if (c < 'a') {
					c += 'z'-'a'+1;
				}
			}
		});
		cout << s << endl;
	}
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>

using namespace std;
char encrypt[50];
char decrypt[50];
int key,i;

int main(){
    while(scanf("%[^\r\n]", encrypt) != EOF){
        while(encrypt[i] != '\0'){
            if(encrypt[i] - encrypt[i+1] == 12){
                key = 't' - encrypt[i];
                break;
            }
            i++;
        }

        i = 0;
        while(encrypt[i] != '\0'){
            if(encrypt[i] <= 'z' && encrypt[i] >= 'a'){
                decrypt[i] = (encrypt[i] - 'a' + key) % 26 + 'a';
            }
            else{
                decrypt[i] = encrypt[i];
            }
            i++;
        }
        printf("%s\n", decrypt);
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

inline int Rotate(char a, char b) {
	return (a - b + ('z' - 'a' + 1)) % ('z' - 'a' + 1);
}

int main(void) {
	char str[81];
	int shift = 0;
	while(cin.getline(str, 81)) {
		shift = 0;
		for(int i = 0; str[i] != NULL; i++) {
			if((str[i] != NULL) && (str[i+1] != NULL) && (str[i+2] != NULL) &&
				(str[i] != ' ') && (str[i+1] != ' ') && (str[i+2] != ' ')) {
					if(Rotate(str[i+1], str[i]) == Rotate('h', 't')) {
						if(Rotate(str[i+2], str[i+1]) == Rotate('e', 'h')) {
							shift = 't' - str[i];
							break;
						}
						if(str[i+3] != NULL && str[i+3] != ' ') {
							if((Rotate(str[i+2], str[i+1]) == Rotate('i', 'h')) && (Rotate(str[i+3], str[i+2]) == Rotate('s', 'i'))) {
								shift = 't' - str[i];
								break;
							}
							if((Rotate(str[i+2], str[i+1]) == Rotate('a', 'h')) && (Rotate(str[i+3], str[i+2]) == Rotate('t', 'a'))) {
								shift = 't' - str[i];
								break;
							}
						}
					}
			}
		}

		for(int i = 0; str[i] != NULL; i++) {
			if(str[i] != ' ' && str[i] != '.') {
				str[i] = (str[i] - 'a' + shift + ('z' - 'a' + 1)) % ('z' - 'a' + 1) + 'a';
			}
		}

		cout << str << endl;
	}
	return 0;
}

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

int main(){
	string str;
	string key_1 = "the",key_2 = "this",key_3 = "that";
	
	while(getline(cin,str))
	{
		for(int i=0;i<26;i++)
		{
			for(int j=0;j<str.size();j++)
			{
				if(str[j]!=' ' && str[j]!='.')
				{
					str[j]++;
					if(str[j] > 'z')str[j] -= 26;
				}
			}
			if(str.find(key_1)!= -1) cout << str << endl;
			else if(str.find(key_2)!= -1) cout << str << endl;
			else if(str.find(key_3)!= -1) cout << str << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
char data[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int main(){
  string s[80];
  int count = 0;
  while(cin >> s[count]) count++;
  bool roop = true;
  while(roop){
    for(int i=0;i<=count;i++){
      for(int j=0;j<s[i].size();j++){
	if(s[i][j]=='z') s[i][j] = 'a';
	if(s[i][j]=='.') continue;
	else s[i][j] = data[int(s[i][j]-'`')]; 
	//cout << s[i][j] << endl;
      }
      if(s[i]=="the"||s[i]=="this"||s[i]=="that") roop = false;
    }
  }
  for(int i=0;i<=count;i++){
    cout << s[i];
    if(i!=count) cout << ' ';
  }
  cout << endl;
  return 0;
}

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

int main(){
	string input;

	while(getline(cin, 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(input.find("the") != string::npos || input.find("this") != string::npos || input.find("that") != string::npos){
				cout << input << endl;
				break;
			}
		}
	}

	return 0;
}

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

using namespace std;

int main(void){
	int i, j;
	string s, suc1("the"), suc2("this"), suc3("that");
	getline(cin,s);
	while(s.find(suc1) == -1 && s.find(suc2) == -1 && s.find(suc3) == -1){	
		for(j = 0;j < s.size();j++){
			if(s[j] == 'z')
				s[j] = 'a';
			else if(isalpha(s[j]))
				s[j]++;
		}
	}
	cout << s << endl;
	return 0;
}

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

int main(){

  string s;
  int k = 0;

  getline(cin,s);

  for(int i=0;i<s.size();i++){
    for(int j=-25;j<26;j++){
      if(s[i]+j == 't' && s[i+1]+j == 'h'){
	if(s[i+2]+j == 'e') k = j;
	if(s[i+2]+j == 'i' && s[i+3]+j == 's') k = j;
	if(s[i+2]+j == 'a' && s[i+3]+j == 't') k = j;
      }
    }
  }

    for(int i=0;i<s.size();i++){
      if(s[i] <= 'z' && s[i] >= 'a') cout << (char)(s[i]+k);
      else cout << s[i];
    }

    cout << endl;

}