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>
#define num 26
using namespace std;

int main(){
	int i;
	string str;
	getline(cin, str);
	string strcp = str;
	string::iterator si;
	for(i=0;i<num;i++){
		if(  strcp.find("this") != string::npos
		  || strcp.find("that") != string::npos
		  || strcp.find("the" ) != string::npos){
			cout << strcp << endl;
		}
		si = strcp.begin();
		while(si != strcp.end()){
			if('a' <= *si && *si <= 'y'){
				*si = *si + char(1);
			}else if(*si == 'z'){
				*si = 'a';
			}
			si++;
		}
	}
	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 <stdio.h>
#include <string.h>

int main(void)
{
	int i;
	int len;
	int f;
	char str[128];
	
	while (fgets(str, 100, stdin) != NULL){
		f = 0;
		while (1){
			len = strlen(str);
			for (i = 0; i < len; i++){
				if (strncmp(&str[i], "the", 3) == 0){
					f = 1;
				}
				if (strncmp(&str[i], "this", 4) == 0){
					f = 1;
				}
				if (strncmp(&str[i], "that", 4) == 0){
					f = 1;
				}
			}
			if (f == 1){
				break;
			}
			for (i = 0; i < len; i++){
				if (str[i] >= 'a' && str[i] < 'z'){
					str[i]++;
				}
				if (str[i] == 'z'){
					str[i] = 'a';
				}
			}
		}
		printf("%s", str);
	}
	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 -= (char)26;
		} else if (c < 'a') {
			c += (char)26;
		}
	});
	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 -= (char)26;
				} else if (c < 'a') {
					c += (char)26;
				}
			}
		});
		cout << s << endl;
	}
}

C++: while line = STDIN.gets

	len = line.length

	while !(line =~ /(the|this|that)/)
	
		for i in 0..len-1 do
			if( line[i,1] =~ /[a-z]/)
				if(line[i,1] =~ /z/)
					line[i] = "a"
				else
					line[i] = line[i].succ
				end
			end
		end
	end
	
	puts line
	
end

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string str,kaku[3]={"the","this","that"};
    while(getline(cin,str)){
        while(1){
            for(int i=0;i<str.size();i++){
                if('A'<=str[i]&&str[i]<='Y')str[i]++;
                else if(str[i]=='Z')str[i]-=25;
                else if('a'<=str[i]&&str[i]<='y')str[i]++;
                else if(str[i]=='z')str[i]-=25;
            }
            for(int i=0;i<3;i++){
                if(str.find(kaku[i])!=string::npos)goto exit;
            }
        }
    exit:
        cout<<str<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main()
{
	int i, j;
	string s, res, tmp;
	while (!cin.eof())
	{
		getline(cin, s);
		res = tmp = s;
		for (i = 0; i < 27; i++)
		{
			res = tmp;
			for (j = 0; j < (int)s.size(); j++)
			{
				if (s[j] != ' ' && s[j] != '.')
				{
					if (s[j] + i > 'z')
						res[j] = 'a' + s[j] + i - 'z' - 1;
					else
						res[j] = s[j] + i;
				}
				else
				{
					res[j] = s[j];
				}
			}
			if (res.find("the") != string::npos || res.find("this") != string::npos || res.find("that") != string::npos)
				break;
		}
		cout << res;
	}
}

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

using namespace std;


int main(){
	string line;

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

		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()-2 ; k++){
				if(line[k] == 't' && line[k+1] == 'h'){
					flag = 1;
					cout << line << endl;
					break;
				}
			}
			if(flag == 1) break;
		}
		//cout << line << endl;
	}
	return 0;
}

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

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

C++: #include <stdio.h>
#include <string.h>
int main(){
  int i,j;
  char s[80];
  int len;
  
  while(gets(s)){
    len=strlen(s);
    
    for(i=0;i<26;i++){
      for(j=0;j<len;j++){
	if(s[j]!=' ' && s[j]!='.'){
	  if(s[j]=='z')s[j]='a';
	  else s[j]++;
	}
      }
      for(j=0;j<len-4;j++){
	if(s[j]=='t' && s[j+1]=='h' && s[j+2]=='e'){printf("%s\n",s);return 0;}
	if(s[j]=='t' && s[j+1]=='h' && s[j+2]=='a' && s[j+3]=='t'){printf("%s\n",s);return 0;}
	if(s[j]=='t' && s[j+1]=='h' && s[j+2]=='i' && s[j+3]=='s'){printf("%s\n",s);return 0;}
      }
      if(s[j]=='t' && s[j+1]=='h' && s[j+2]=='e'){printf("%s\n",s);return 0;}
    }
  }
  memset(s,'\0',sizeof(s));
  return 0;
}