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<cstring>
#define MAX 90
using namespace std;
char str[MAX];
bool contain(){
	for(int i=0;str[i]!='\0';i++){
		if(str[i]=='t'){
			if(strncmp(&str[i],"the",3)==0)
			return 1;
			else if(strncmp(&str[i],"this",4)==0)
			return 1;
			else if(strncmp(&str[i],"that",4)==0)
			return 1;
		}
	}
	return 0;
}
void rotate(){
	for(int i=0;str[i]!='\0';i++)
	if(str[i]=='z')
	str[i]='a';
	else if(isalpha(str[i]))
	str[i]=(char)(str[i]+1);
}
int main(){
	while(cin.getline(str,MAX)){
		for(int i=0;i<26;i++){
			rotate();
			if(contain())
				break;
		}
		cout<<str<<endl;
	}
	return 0;
}

C++: 
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string s;
  int pl=0;
  while(getline(cin,s)){
    if(s=="\n"&&s=="EOF")  break;
  for(int i =-30;i<30;i++){
    for(int j = 0; j < s.size(); j++){
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'e'){
	pl = i;
	break;
      }
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'a' && s[j+3]+i=='t'){
	pl = i;
	break;
      }
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'i' && s[j+3]+i=='s'){
	pl = i;
	break;
      }
    }
    if(pl!=0) break;
  }
  for(int i=0;i <s.size();i++){
    if(s[i]<='z' && s[i]>='a') s[i] += pl;
    if(s[i]!=' ' && s[i]!=',' && s[i]!='.'){
    	if(s[i]>'z') s[i]-=26;
    	else if(s[i]<'a') s[i]+=26;
    }
  } 
  cout<<s<<endl;
  pl=0;
  }
}

C++: #include <iostream>
#include <string>
#include <cctype>

using namespace std;

void Shift(string *str, int shift, int vec) {
  for (int str_i = 0; str_i < str->size(); str_i++)
    if (!isspace((*str)[str_i]) && (*str)[str_i] != '.')
      (*str)[str_i] += vec * shift;
}

bool FindTarget(string str) {
  if (str.find("the") != string::npos ||
      str.find("this") != string::npos ||
      str.find("that") != string::npos)
    return true;
  else
    return false;
}

int main() { 
  string input_str;

  int shift = 1;
  while (getline(cin, input_str)) {
    while (1) {
      Shift(&input_str, shift, -1);
      if (FindTarget(input_str))
        break;
      Shift(&input_str, shift, 1);
      shift++;
    }
    cout << input_str << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>

using namespace std;

void solve()
{
	string str;
	while(getline(cin, str))
	{
		string word;
		int n = str.size();
		for(int j = 0; j < 26; ++j)
		{
			word.clear();
			for(int i = 0; i < n; ++i)
			{
				if('a' <= str[i] && str[i] <= 'z')
				{
					word += (str[i] + j -'a') % 26 + 'a';
				}
				else
				{
					word += str[i];
				}
			}
			if(word.find("this") != -1 || word.find("the") != -1 || word.find("that") != -1)
			{
				cout << word << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0;            } while(0)

int main(void){
    char buf[100];
    while(GETSTR(buf)){
        CHOMP(buf);
        int len = strlen(buf);

        const int nn = 'z' - 'a' + 1;

        while(1){
            for(int i = 0; i < len; i++){
                if(isalpha(buf[i])){
                    buf[i] = 'a' + (buf[i] - 'a' + nn + 1) % nn;
                }
            }
            char buf2[100];
            sprintf(buf2, " %s ", buf);
            int l = strlen(buf2);
            for(int i = 0; i < l; i++){
                if(! isalpha(buf2[i])) buf2[i] = ' ';
            }
            if(strstr(buf2, " the ") != NULL) break;
            if(strstr(buf2, " this ") != NULL) break;
            if(strstr(buf2, " that ") != NULL) break;
        }
        puts(buf);
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	while(getline(cin, s)){
		for(int i = 0; i < 26; ++i){
			for(int j = 0; j < s.size() - 1; ++j){
				if(s[j] == 'a')
					s[j] = 'z';
				else if(s[j] == ' ')
					continue;
				else
					s[j]--;
			}
			string t("");
			for(int j = 0; j < s.size() - 1; ++j){
				if(s[j] == ' '){
					if(t == "the" || t == "this" || t == "that"){
						cout << s << endl;
						goto end;
					}
					t = "";
				}
				else{
					t += s[j];
				}
			}
		}
		end:;
	}
	return 0;
}

C++: #include <iostream>
#include <string>

char chshift(char ch){
  if(ch>='a' && ch<='z'){
    return (ch-'a'+1)%26+'a';
  }else{
    return ch;
  }
}

std::string strshift(std::string s){
  for(int i=0; i<s.length(); i++){
    s[i] = chshift(s[i]);
  }
  return s;
}

bool valid_text_p(std::string str){
  return str.find("the") != -1 && str.find("that") != -1 && str.find("this") != -1;
}

int main(){
  std::string s;
  while(std::getline(std::cin,s), !std::cin.eof()){
    for(;;s = strshift(s)){
      if(valid_text_p(s)){
	std::cout << s << std::endl;
	break;
      }
    }
  }
  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<algorithm>
#include<string>
using namespace std;
int main(){
  string s;
  int pl=0;
  getline(cin,s);
  for(int i =-30;i<30;i++){
    for(int j = 0; j < s.size()-3; j++){
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'e'&& s[j+3]==' '){
	pl = i;
	break;
      }
      if(j==s.size()-1) break;
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'a' && s[j+3]+i=='t' && s[j+4]==' '){
	pl = i;
	break;
      }
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'i' && s[j+3]+i=='s' && s[j+4]==' '){
	pl = i;
	break;
      }
    }
    if(pl!=0) break;
  }
  for(int i=0;i <s.size();i++){
    if(s[i]<='z' && s[i]>='a') s[i] += pl;
  }
  cout<<s<<endl;
}