Go: package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
	"reflect"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func cipher(text string, direction int, int_shift int) string {
	shift, offset := rune(int_shift), rune(26)
	runes := []rune(text)
	for index, char := range runes {
		switch direction {
		case 1:
			if char >= 'a' && char <= 'z'-shift || char >= 'A' && char <= 'Z'-shift {
				char = char + shift
			} else if char > 'z'-shift && char <= 'z' || char > 'Z'-shift && char <= 'Z' {
				char = char + shift - offset
			}
		case -1:
			if char >= 'a'+shift && char <= 'z' || char >= 'A'+shift && char <= 'Z' {
				char = char - shift
			} else if char >= 'a' && char < 'a'+shift || char >= 'A' && char < 'A'+shift {
				char = char - shift + offset
			}
		}
		runes[index] = char
	}
	return string(runes)
}

func main() {
	for {
		infos := strings.Split(nextString(), " ")
		plain := make([]string, len(infos))
		if reflect.DeepEqual(infos, []string{}) {
			break
		}
		fmt.Println(infos)
		Decryption:
			for i := 0; i < 26; i++ {
				for j := range infos {
					plain[j] = cipher(infos[j], 1, i)
				}
				for j := range plain {
					if plain[j] == "this" || plain[j] == "that" || plain[j] == "the" {
						break Decryption
					}
				}
			}
			fmt.Println(strings.Join(plain, " "))
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
int main() {
	int p, q, r;
	string x = "this the that";
	//cout << x.find("the") << endl << x.find("that") << endl << x.find("this") << endl;
	string a = "abcde";
	//cout << (int)a.find("the") << endl << (int)a.find("that") << endl << (int)a.find("this") << endl;
	string s;
	getline(cin, s);
	//cout << (int)s.find("the") << endl << (int)s.find("that") << endl << (int)s.find("this") << endl;
	for (int j = 0;; j++) {
		p = (int)s.find("the");
		q = (int)s.find("that");
		r = (int)s.find("this");
		//cout << p << q << r << endl;
		if (p>=0||q>=0||r>=0) {
			cout << s << endl;
			break;
		}
		for (int i = 0; i < s.size(); i++) {
			if (isalpha(s[i])) {
				if (s[i] == 'z')s[i] = 'a';
				else s[i]++;
				
			}
		}
	}
	return 0;
}

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

int main()
{
	string s;
	while (getline(cin, s)) {
		int n = s.size();
		for (int i = 0; i < 26; i++) {
			bool flag = false;
			for (int j = 0; j + 3 <= n; j++) {
				if (s.substr(j, 3) == "the" && (j == 0 || s[j - 1] < 'a' || s[j - 1] > 'z') && (j + 3 == n || s[j + 3] < 'a' || s[j + 3] > 'z')) {
					flag = true;
				}
			}
			for (int j = 0; j + 4 <= n; j++) {
				if (s.substr(j, 4) == "this" && (j == 0 || s[j - 1] < 'a' || s[j - 1] > 'z') && (j + 4 == n || s[j + 4] < 'a' || s[j + 4] > 'z')) {
					flag = true;
				}
			}
			for (int j = 0; j + 4 <= n; j++) {
				if (s.substr(j, 4) == "that" && (j == 0 || s[j - 1] < 'a' || s[j - 1] > 'z') && (j + 4 == n || s[j + 4] < 'a' || s[j + 4] > 'z')) {
					flag = true;
				}
			}
			if (flag) {
				cout << s << endl;
				break;
			}
			for (int j = 0; j < n; j++) {
				if (s[j] >= 'a' && s[j] <= 'z') {
					s[j] = s[j] == 'z' ? 'a' : s[j] + 1;
				}
			}
		}
	}
	return 0;
}

C++: #include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <regex>

using namespace std;

string decode(string inp,int n){
    for(int i=0;i<inp.length();i++){
        if('a'<=inp[i]&&inp[i]<='z'){
            
            inp[i]=inp[i]-n;
            if(inp[i]<'a') inp[i]+=('z'-'b');
        }
    }
    return inp;
}
int main(){
    string input,decoded;
    regex pattern("(( t|(^t))he)|(( t|(^t))his)|(( t|(^t))hat)");
    while(getline(cin,input)){
        for(int i=0;i<26;i++){
            decoded=decode(input,i);
            if(regex_search(decoded.begin(),decoded.end(),pattern)){
                break;
            }
        }
        cout << decoded << endl;
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    string s;
    int i, j;

    while( getline(cin, s) ){
        while(s.find("the") == s.npos && s.find("this") == s.npos && s.find("that") == s.npos){
            for(i = 0; s[i] != '.'; i++){
                s[i]++;
                if(s[i] == 'z' + 1){
                    s[i] = 'a';
                }
            }
        }
        cout << s << endl;
    }
}

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

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

bool dec(string str, string array[]) {
  for (int i = 0; i < 3; i++) {
    if (str.find(array[i], 0) != string::npos) return false;
  }
  return true;
}

int main() {
  string array[3] = {"the", "this", "that"};
  while (1) {
    string str;
    getline(cin, str);
    while (dec(str, array)) {
      for (int i = 0; str[i] != '\0'; i++) {
	if (str[i] >= 'a' && str[i] <= 'z') {
	  if (str[i] == 'z') str[i] = 'a';
	  else str[i]++;
	}
      }
      
    }
    cout << str << endl;
  }
  return 0;
}

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

bool checkString(int* key, string s);
void rotateChar(string* s, int i);

int main()
{
    list<string> table;
    char text[80];

	for(int i=0; cin.get(text[i]); i++ ){;}

	char ch;
	string s;
	for(int i=0; (ch=text[i])!=EOF; i++){
		if(ch!=' ')s.push_back(ch);
		else{ table.push_back(s), s.clear();}
	}		

    int key; // ずらす文字数
    list<string>::iterator i;
    for(i=table.begin(); i!=table.end(); i++){
        // cout << *i << " ";
        if( i->size() == 3 || i->size() == 4 )
            if( checkString(&key, *i) ) break;
    }
	
	for(int i=0; ch=text[i]; i++){
		if(isalpha(ch)){
        char c = ch - 'a';
        ch = 'a' + (c+key)%26;
		}
		cout.put(ch);
	}
            
    return 0;
}

void rotateChar(string* s, int i) // iは何文字ずらしたいか
{

    for(int j=0; j<s->size(); j++){
        if(!isalpha(s->at(j))){continue;}
        char c = s->at(j) - 'a';
        s->at(j) = 'a' + (c+i)%26;
    }
}

bool checkString(int* key, string s)
{

    for(int i=0; i<26; i++){
        string tmp = s;
        rotateChar(&tmp, i);
        // cout << tmp << endl;
        if( tmp=="the" || tmp=="this" || tmp=="that" ){
            *key=i;
            return true;
        }
    }
    return false;
}