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<stdio.h>

int main(){

	char s[1000];
	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 <algorithm>
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;

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

    return 0;
}

C++: #include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
 
int main() {
    string s;
    while(getline(cin, s)){
    	rep(i, 26) {
	    	rep(j, s.size()) {
	            if('a' <= s[j] && s[j] < 'z') s[j] = s[j] + 1;
	            else if(s[j] == 'z') s[j] = 'a';
	        }
	        if(s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos){
                cout << s << endl;
            }
	    }
    }
    return 0;
}

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

using namespace std;

int main(int argc, char const* argv[])
{
	string str;

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

C++: #include <iostream>
#include <string>
#include <vector>
using namespace std;
string caesar(string str,int num){
	string ret;
	char c;
	for(int i=0;i<str.size();i++){
		c=str[i]+(num-26);
		if(c<'a') c+=26;
		ret+=(char)c;
	}
	return ret;
}

char caesarc(char c,int num){
	c+=(num-26);
	if(c<'a') c+=26;
	return c;
}

int main(){
	string str,sts;
	vector<string> ary;
	getline(cin,str);
	str+=" ";
	bool hog[3];
	string tes[3];
	int j;
	for(int i=0;i<26;i++){
		hog[0]=hog[1]=hog[2]=false;
		sts="";
		j=0;
		tes[0]=caesar("this",i);
		tes[1]=caesar("that",i);
		tes[2]=caesar("the",i);
		while(j<str.size()){
			sts="";
			while(str[j]!=' '&&str[j]!='.'){
				sts+=str[j];
				j++;
			}
			for(int k=0;k<3;k++){
				if(tes[k]==sts) hog[k]=true;
			}
			j++;
		}
		if(hog[0]&&hog[1]&&hog[2]){
			for(int k=0;k<str.size()-1;k++){
				if('a'<=str[k]&&str[k]<='z'){
					cout<<caesarc(str[k],26-i);
				}
				else cout<<str[k];
			}
			cout<<endl;
			break;
		}
	}
	return 0;
}

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

char seather(char c, int n) {
  if (c == ' ') return ' ';
  if (c == '.') return '.';

  int nn = c + n;
  if (nn > 122) return char(nn - 122 + 97 - 1);
  return char(nn);
}

string decrypt(string str) {
  for (int i = 0; i < 26; i++) {
    string can = "";
    for (int j = 0; j < str.length(); j++) {
      can += seather(str[j], i);
    }
    if(can.find("the") != string::npos || can.find("this") != string::npos || can.find("that") != string::npos) {
      return can;
    }
  }

  return "could not decrypt" + str;
}

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

  string input;
  while(getline(cin, input)) {
    if (input == "") continue;
    cout << decrypt(input) << "\n";
  }

  return 0;
}

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)) {
            cout << str << endl;
            return 0;
        }
    }
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

char ch;
string text;

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