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<cstdio>

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;
}

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 <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;

string key[3]={"the","this","that"};

string s,s2;

int main(){
	while(getline(cin,s)){
		bool flg=false;
		REP(c,'z'-'a'+1){
			s2=s;
			REP(i,s2.length()){
				if (s2[i]!=' ' && s2[i]!='.'){
					if ((int)s2[i]+c>'z'){
						s2[i]+='a'-'z'-1;
					}
					s2[i]+=c;
				}
			}
			REP(i,3){
				if (s2.find(key[i])!=string::npos){
					cout<<s2<<endl;
					flg=true;
					break;
				}
			}
			if (flg) break;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

struct inc{
  void operator() (char &c){
    if(isalpha(c)){
      if(islower(c))
	c = (((c - 'a') + 1) % ('z'-'a'+1)) + 'a';
      else
	c = (((c - 'A') + 1) % ('Z'-'A'+1)) + 'A';
    }
  }
};

int main(){
  string str;
  while(getline(cin, str)){
    bool f = true;
    while(f){
      for_each(str.begin(), str.end(), inc());
      stringstream ss(str);
      string tmp;
      while(ss>>tmp)
	if(tmp == "the" || tmp == "this" || tmp == "that" ||
	   tmp == "THE" || tmp == "THIS" || tmp == "THAT"){
	  cout << str << endl;
	  f = false;
	  break;
      }
    }
  }
  return 0;
}

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

int is_contain_keywords(string str,vector<string>& keywords) {
  int cnt = 0;
  vector<string>::iterator key_itr = keywords.begin();
  while(key_itr != keywords.end()) {
    if(str.find(*key_itr) != string::npos) {
      cnt++;
    }
    key_itr++;
  }
  return cnt;
}

string decode(string cipher) {
  vector<string> keywords;
  keywords.push_back("the");
  keywords.push_back("this");
  keywords.push_back("that");

  int remind_shift = -1;
  int max_cnt = 0;
  int str_len = cipher.length();
  for(int shift = 0;shift < 'z' - 'a';shift++) {
    string str = cipher;
    for(int i=0;i<str_len;i++) {
      if('a' < cipher[i] && cipher[i] < 'z') {
        str[i] = (cipher[i] - 'a' + shift) % ('z' - 'a') + 'a';
      }
    }
    if(is_contain_keywords(str,keywords) > max_cnt) {
      max_cnt = is_contain_keywords(str,keywords);
      remind_shift = shift;
    }
  }
  string ans = cipher;
  for(int i=0;i<str_len;i++) {
    if('a' < cipher[i] && cipher[i] < 'z') {
      ans[i] = (cipher[i] - 'a' + remind_shift) % ('z' - 'a') + 'a';
    }
  }
  return ans;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string cipher;
  getline(cin,cipher);
  cout << decode(cipher) << endl;
}

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

const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main()
{
  string s;
  while (getline(cin, s)) {

    for (int i = 0; i < 26; ++i) {
      for (unsigned int j = 0; j < s.size(); ++j) {
	if (isalpha(s[j]))
	  s[j] = alpha[(s[j]-'a'+1)%alpha.size()];
      }
      if (s.find("the", 0) != string::npos ||
	  s.find("this", 0) != string::npos ||
	  s.find("that", 0) != string::npos)
	break;
    }

    cout << s << endl;

  }
  return 0;
}