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>
#include <cstring>
using namespace std;
int main()
{
	char t[27][27] = {"bcdefghijklmnopqrstuvwxyza", "cdefghijklmnopqrstuvwxyzab", "defghijklmnopqrstuvwxyzabc",
		"efghijklmnopqrstuvwxyzabcd", "fghijklmnopqrstuvwxyzabcde", "ghijklmnopqrstuvwxyzabcdef",
		"hijklmnopqrstuvwxyzabcdefg", "ijklmnopqrstuvwxyzabcdefgh", "jklmnopqrstuvwxyzabcdefghi",
		"klmnopqrstuvwxyzabcdefghij", "lmnopqrstuvwxyzabcdefghijk", "mnopqrstuvwxyzabcdefghijkl",
		"nopqrstuvwxyzabcdefghijklm", "opqrstuvwxyzabcdefghijklmn", "pqrstuvwxyzabcdefghijklmno",
		"qrstuvwxyzabcdefghijklmnop", "rstuvwxyzabcdefghijklmnopq", "stuvwxyzabcdefghijklmnopqr",
		"tuvwxyzabcdefghijklmnopqrs", "uvwxyzabcdefghijklmnopqrst", "vwxyzabcdefghijklmnopqrstu",
		"wxyzabcdefghijklmnopqrstuv", "xyzabcdefghijklmnopqrstuvw", "yzabcdefghijklmnopqrstuvwx",
		"zabcdefghijklmnopqrstuvwxy"};
	char s[81], r[81];
	string u;
	int i, j;
	while (1)
	{
		cin.getline(s, sizeof(s));
		if (cin.eof()) break;
		for (i = 0; i < 27; i++)
		{
			for (j = 0; j < strlen(s); j++)
			{
				if ('a' <= s[j] && s[j] <= 'z')
					r[j] = t[i][(int)(s[j]-'a')];
				else
					r[j] = s[j];
			}
			r[strlen(s)] = '\0';
			u = r;
			if (u.find("the") != string::npos && u.find("this") != string::npos && u.find("that") != string::npos)
			{
				cout << u << endl;
				break;
			}
		}
	}
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 1000000000;
using namespace std;
int main() {
  string n;
  while (getline(cin, n)) {
    string ans = n;
    for (int i = 0; i < 26; i++) {
      if (ans.find("the") != -1 || ans.find("that") != -1 ||
          ans.find("this") != -1)
        break;
      for (int j = 0; j < ans.size(); j++) {
        if (ans[j] == ' ' || ans[j] == '.')
          continue;
        if (ans[j] == 'z')
          ans[j] = 'a';
        else
          ans[j]++;
      }
    }
    cout << ans << endl;
  }
  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;
	while(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<cstring>
using namespace std;
int main(){
  char a[81];
  cin.getline(a,81);
  while(1){
    for(int i=0;i<strlen(a);i++){
      if(a[i]==' '||a[i]=='.') continue;
      else if(a[i]=='z') a[i] = 'a';
      else a[i] = a[i]-'a'+'b';
    }
    for(int i=0;i<strlen(a)-3;i++){
      if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='i'&&a[i+3]=='s') goto END;
      if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='a'&&a[i+3]=='t') goto END;
      if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='e') goto END;
    }
  }
 END:
  for(int i=0;i<strlen(a);i++) cout << a[i];
  cout << endl;
  return 0;
}

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

typedef pair<string, string> P;

P next_word(string sentence) {
  if (sentence.empty()) return make_pair(string(""), string(""));
  if (sentence[0] == ' ' || sentence[0] == '.') {
    return make_pair("", sentence.substr(1));
  } else {
    P recur = next_word(sentence.substr(1));
    return make_pair(sentence[0] + recur.first, recur.second);
  }
}

bool acceptable(string sentence) {
  P p = next_word(sentence);

  while (! p.first.empty() ) {
    if (p.first == "this" || p.first == "the" || p.first == "that")
      return true;

    p = next_word(p.second);
  }
  return false;
}

char slip(char c) {
  if (c < 'a' || 'z' < c) return c;
  
  string alphabet = "abcdefghijklmnopqrstuvwxyza";
  int index = (int)(c - 'a');
  return alphabet[index + 1];
}

char slip(char c, int n) {
  for (int i = 0; i < n; i++)
    c = slip(c);

  return c;
}

string slip(string code, int n) {
  string val;
  for (int i = 0, len = code.length(); i < len; i++)
    val += slip(code[i], n);

  return val;
}

string decode(string code) {
  for (int i = 1; i < 27; i++) {
    string sentence = slip(code, i);
    if (acceptable(sentence))
      return sentence;
  }

  return "";
}

int main() {
  string code;
  while ( getline(cin, code) )
    cout << decode(code) << endl;
}

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

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

int main(){
    scanf("%[^\r\n]", encrypt);
    while(encrypt[i] != '\0'){
        if((i != 0 && encrypt[i-1] == ' ' && encrypt[i] - encrypt[i+1] == 12) || 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>
#include<string>
using namespace std;
int main() {
	string str;
	while (getline(cin, str)) {
		string st = str;
		string s[1000],h="";
		str += " ";
		int c = 0;
		for (int i = 0; i < str.length(); i++) {
			for (int j = i; j < str.length(); j++) {
				if (str[j] == '.' || str[j] == ' ') {
					if (h != "") {
						s[c] = h;
						h = "";
						c++;
					}
					i = j ;
					break;
				}
				else
					h += str[j];
			}
		}
		int w = 0;
		for (int i = 0; i < c; i++) {
			if (s[i].length() == 3 || s[i].length() == 4) {
				int t = (int)'t' - (int)s[i][0];
				string h = "t";
				for (int j = 1; j < s[i].length(); j++) {
					int u = t + (int)s[i][j];
					if (u > 'z') u -= 26;
					else if (u < 'a') u += 26;
					h += (char)u;
				}
				if (h == "the" || h == "that" || h == "this") {
					w = t;
					break;
				}
			}
		}
		string stri = "";
		for (int i = 0; i < st.length(); i++) {
			if (st[i] == ' ' || st[i] == '.')
				stri += st[i];
			else {
				int u;
				u = (int)st[i] + w;
				if (u > 'z') u -= 26;
				else if (u < 'a')u += 26;
				stri += (char)u;
			}
		}
		cout << stri << endl;
	}
}