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 main(){
	string str,dammy;
	int s;
	while(getline(cin,str)){
		dammy=str;
		for(int i=1;i<27;i++){
			for(int j=0;j<str.size();j++)if(str[j]!=' '&&str[j]!='.')str[j]++;
			//cout<<str<<endl;
			for(int j=0;j<str.size();j++)if(str[j]>'z')str[j]='a';
			s=str.find("this");
			if(s!=string::npos)break;
			s=str.find("that");
			if(s!=string::npos)break;
			s=str.find("the");
			if(s!=string::npos)break;
		}
	cout<<str<<endl;
}
}

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

int main() {
    using namespace std;
    string str;
    getline(cin, str);
    regex pattern(".*(the|this|that).*");
    smatch sm;
    for (int c = 0; c < 'z' - 'a' + 1; ++c) {
        for (size_t i = 0; i < str.size(); ++i) {
            if ('a' <= str[i] && str[i] <= 'z') {
                if (str[i] == 'z') {
                    str[i] = 'a';
                } else {
                    str[i] += 1;
                }
            }
        }
        //if (regex_match(str, sm, pattern)) {
        if (str.find( "the" ) != string::npos || str.find( "this" ) != string::npos || str.find( "that" ) != string::npos) {
            cout << str << endl;
            return 0;
        }
    }
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    string s[] = {"the","this","that"};
    string in;
    while(true){
	getline(cin,in);
	if(cin.eof()) break;
	bool f = false;
	int d = 1;
	REP(i,30){

	    f = true;
	    REP(i,in.size()){
		if(in[i] == '.' || in[i] == ' ' || in[i] == '\n') continue;
		in[i]= (char)( 'a' + ( (int)(in[i] - 'a') + d) % 26);
	    }
	    vector<bool> flgs(3,false);
	    REP(j,3){
		if(in.substr(0,s[j].size()) == s[j] && in[s[j].size()] == ' ') flgs[j] = true;
	    }
	    for(int i=0;i<in.size();i++){
		if(in[i] == ' '){
		    REP(j,3){
			if(in.substr(i+1,s[j].size()) == s[j] && in[i + s[j].size() + 1] == ' ') flgs[j] = true;
		    }
		}
	    }
	    if(flgs[0] || flgs[1] || flgs[2]) break;
	}
	cout << in << endl;
    }

    return 0;
}

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

using namespace std;


int main(){

	string line;

	while(getline(cin, line)){

		string str[80], ans[80];
		int count = 0;
		int flag = 0;
		int slide;

		//???????????????
		/*
		string temp;
		for(int i=0 ; i<line.size()-1 ; i++){
			temp += line[i];
		}
		line = temp;
		*/
		

		//???????????????????????¨???????´?
		for(int i=0 ; i<line.size() ; i++){
			if(line[i] == ' '){
				count++;
			}else{
				str[count] += line[i];
				ans[count] = str[count];
			}
		}
		count++;


		for(int i=1 ; i<=26 ; i++){
			for(int j=0 ; j<count ; j++){
				for(int k=0 ; k<str[j].size() ; k++){
					if(str[j][k] >= 'a' && str[j][k] <= 'z'){
						str[j][k]++;
						if(str[j][k] > 'z'){
							str[j][k] = str[j][k] - 'z' + 'a' -1;
						}
					}
					if(str[j][k] == 'h' && str[j][k-1] == 't'){
						flag = 1;
						slide = i;
						break;
					}
				}

				/*
				if(str[j] == "this" || str[j] == "the" || str[j] == "that"
						|| str[j] == "this." || str[j] == "the." ||str[j] == "that."){
					flag = 1;
					slide = i;
					break;
				}
				*/
			}
			if(flag == 1)break;
		}

		for(int i=0 ; i<count ; i++){
			for(int j=0 ; j<ans[i].size() ; j++){
				if(ans[i][j] >= 'a' && ans[i][j] <= 'z'){
					if((ans[i][j] + slide) > 'z' ){
						ans[i][j] = ans[i][j] - 'z' + 'a' + slide -1;
					}else{
						ans[i][j] = ans[i][j] + slide ;
					}
				}
			}
		}

		for(int i=0 ; i<=count ; i++){
			cout << ans[i];
			if(i < count) cout << ' ';
		}
		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 <stdio.h>
#include <string.h>

int
main(void)
{
	char line[100];
	char res[100];

	auto chksep = [](char c) -> bool {
			return (c == ' ' || c == '.' || c == '\n');
		};

	while (fgets(line, sizeof line, stdin)) {
		int len = strlen(line);
		int state = 0;
		
		for (int s = 0; s < 26; s++) {

			for (int i = 0; i < len; i++) {
				if (chksep(line[i])) {
					res[i] = line[i];
				} else {
					int c = line[i] + s;
;					if (c > 'z') {
						res[i] = c - 'z' + 'a' - 1;
					} else {
						res[i] = c;
					}
				}

				switch (state) {
				case 0:
					if (res[i] == 't') {
						state = 1;
					}
					break;

				case 1:
					if (res[i] == 'h') {
						state = 2;
					} else {
						state = 0;
					}
					break;

				case 2:
					if (res[i] == 'e') {
						state = 5;
					} else if (res[i] == 'i') {
						state = 3;
					} else if (res[i] == 'a') {
						state = 4;
					} else {
						state = 0;
					}
					break;

				case 3:
					if (res[i] == 's') {
						state = 5;
					} else {
						state = 0;
					}
					break;

				case 4:
					if (res[i] == 't') {
						state = 5;
					} else {
						state = 0;
					}
					break;

				case 5:
					if (chksep(res[i])) {
						state = 99;
					} else {
						state = 0;
					}
					break;
				}
			}

			if (state == 99) {
				res[len] = 0;
				printf("%s", res);
				break;
			}
		}
	}

	return 0;
}