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 find_cnt;
string find_str;

bool find(string str, string can) {
  string tmp_can = can;
  string tmp_str = str;
  int cnt = 0;
  for (int i = 0; i < tmp_str.length(); ++i) {
    if (string::npos != tmp_str.find(tmp_can, i)) {
      cnt++;
    }
  }
  if (find_cnt < cnt) {
    find_cnt = cnt;
    find_str = str;
  }
  return false;
}

int main() {
  string str;
  string candies[] = {"this", "the", "that"};
  while(getline(cin, str)) {
    find_cnt = 0;
    find_str = "";
  for (int m = 1; m < 26; ++m) {
    for (int i = 0; i < str.length(); ++i) {
      if (str[i] == ' ') {
        continue;
      }
      if (str[i] == ',' || str[i] == '.') {
        str[i] = ' ';
        continue;
      }
      if (m != 1) {
        int char_id = static_cast<int>(str[i]) - 97;
        int shifted = static_cast<int>(char_id + 1);
        str[i] = static_cast<char>(shifted % 26 + 97);
      }
    }
    for (int i = 0; i < sizeof(candies) / sizeof(candies[0]); ++i) {
      find(str, candies[i]);
    }
  }
  if (find_str != "") { 
    cout << find_str << endl;
  }
  }
  return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

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

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

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define pb(a) push_back(a)

char in(char data){
  if(data < 'a' || 'z' < data)return data;
  if('z' == data){
    return 'a';
  }else{
    return ++data;
  }
}
int main(void){
  string str;
  vector<string> pa;
  getline(cin,str);
  str+= " ";
  string w;
  for(int i = 0 ; i < str.size() ; i ++){
    if(str[i] == ' '){
      pa.pb(w);
      w="";
    }else{
      w+=str[i];
    }
  }
  string t[3] = {"this","the","that"};
  while(true){
    vector<string> after;
    bool find = false;
    rep(i,pa.size()){
      rep(j,3){
	if(pa[i] == t[j])find = true;
      }
      w = "";
      rep(j,pa[i].size()){
	w += in(pa[i][j]);
      }
      after.pb(w);
    }
    if(find)break;
    pa=after;
  }
  rep(i,pa.size())cout<<pa[i]<<" ";
  cout<<endl;
}

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

int main(){
  string str;
  string word[111];
  string com[3]={"the","this","that"};
  int cou=0;
  while(cin >> str){
    word[cou] = str;
    cou++;
  }

  while(1){
    bool flag = false;
    for(int i=0;i<cou;i++){
      for(int j=0;j<word[i].size();j++){
	if(word[i][j] == 'z'){
	  word[i][j] = 'a';
	}
	else if(word[i][j] >= 'a' && word[i][j] <= 'z'){
	  word[i][j]++;
	}
      }
      for(int j=0;j<3;j++){
	if(word[i] == com[j]){
	  flag = true;
	  break;
	}
      }
    }
    if(flag == true){
      break;
    }
  }
  for(int i=0;i<cou;i++){
    cout << word[i];
    if(i == cou-1) cout << endl;
    else cout << " ";
  }
}

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

int main(void){
	char data[100];
	char s1[]="the",
		 s2[]="this",
		 s3[]="that";
	int i,cnt=0;
	char *p;

	while((fgets(data,100,stdin))){
		while(cnt<26){
			p=strstr(data,s1);
			if(p)
				break;
			p=strstr(data,s2);
			if(p)
				break;
			p=strstr(data,s3);
			if(p)
				break;
			for(i=0;i<100;i++){
				if(data[i]=='\0')
					break;
				if('a'<=data[i] && data[i]<='y')
					data[i]++;
				else if('z'==data[i])
					data[i]='a';
			}
			cnt++;
		}
		cnt=0;
		printf("%s",data);
	}

	return 0;
}

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

int attack(string line)
{
    static const string cmp[3] = {"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 ((c[i] - 't') % 26 != (word[i] - first) % 26)
                    break;
            if (i == c.size()) {
                int div = ('t' - first) % 26;
                return (div >= 0) ? div : 26 + div;
            }
        }
    }

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

    while (getline(cin, s)) {
        while (s.find("the") == s.npos &&
                    s.find("this") == s.npos &&
                    s.find("that") == s.npos) {
            for (int i = 0; i < s.size(); i++) {
                if (s[i] >= 'a' || 'y' <= s[i]) {
                    s[i]++;
                } else {
                    s[i] = 'a';
                }
            }
        }
        cout << s << endl;
    }

    return 0;
}