Go: package main

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

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 len(infos) == 0 {
			break
		}
		// 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++: #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;
}

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

int main(){
	string str;
	int zure;
	bool flag = false;
	char mozi;
	while(getline(cin, str)){
		for(int j = 0; j < 26; j++){
			for(int i = 0; i < str.size()-2; i++){
				if(str[i] == 't'+j && str[i+1] == 'h'+j && str[i+2] == 'e'+j){
					zure = j;
					flag = true;
					break;
				}
			}
			if(flag == true){
				break;
			}
			for(int i = 0; i < str.size()-3; i++){
				if(str[i] == 't'+j && str[i+1] == 'h'+j && str[i+2] == 'i'+j && str[i+3] == 's'+j){
					zure = j;
					flag = true;
					break;
				}
			}
			if(flag == true){
				break;
			}
			for(int i = 0; i < str.size()-3; i++){
				if(str[i] == 't'+j && str[i+1] == 'h'+j && str[i+2] == 'a'+j && str[i+3] == 't'+j){
					zure = j;
					flag = true;
					break;
				}
			}
			if(flag == true){
				break;
			}
		}
		for(int i = 0; i < str.size(); i++){
			if(str[i] >= 'a' && str[i] <= 'z'){
				str[i] = str[i]-zure;
				cout << str[i];
			}
			else{
				cout << str[i];
			}
		}
		cout << endl;
	}
}

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

#define PI (3.141592)

int main()
{
	string str;
	int len;
	int i,j;
	while( getline(cin,str)) {
		len = str.length();
		for(i = 0; i < 25; i++ ) {
			for ( j = 0; j < len; j++ ) {
				if ( 'a' <= str[j] && str[j] <= 'z') {
					str[j]++;
					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;
}