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 <stdio.h>
#include <iostream>
#include <ctype.h>
#include <string>

using namespace std;

int main(void){
	int i, j;
	string s, suc1("the"), suc2("this"), suc3("that");
	while(getline(cin,s)){
		while(s.find(suc1) == -1 && s.find(suc2) == -1 && s.find(suc3) == -1){	
			for(j = 0;j < s.size();j++){
				if(s[j] == 'z')
					s[j] = 'a';
				else if(isalpha(s[j]))
					s[j]++;
			}
		}
		cout << s << endl;
	}
	return 0;
}

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

using namespace std;

int main(){

	string sstr;
	while(1){
		getline(cin,sstr);
		if(cin.eof())
			break;

		string retStr;
		for(int i = 1; i < 26; i++){
			string str=sstr;
			if(i==4){
			//	cout<<endl;
			}
			for(int j = 0; j < str.size(); j++){
				if(str[j] >= 'a' && str[j] <= 'z'){
					str[j] = str[j] - i;
					if(str[j] < 'a'){
						str[j]+=26;
					}
				}
			}
			bool f=false;
			for(int j = 0; j + 2 < str.size(); j++){
				if(str.substr(j,3)=="the"){
					f=true;
					break;
				}
				else if(j+3<str.size()&& str.substr(j,4)=="this"){
					f=true;
					break;
				}
				else if(j+3<str.size()&&str.substr(j,4)=="that"){
					f=true;
					break;
				}
			}
			if(f){
				retStr=str;
				break;
			}
		}

		cout<<retStr<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<math.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.length();j++)
                if(s[j]>='a'&&s[j]<='z')
                    s[j]='a'+(s[j]-'a'+1)%26;
            for(int j=2;j<s.length();j++){
                if(s[j]=='e'&&s[j-1]=='h'&&s[j-2]=='t'){
                    if((j-3<0||s[j-3]<'a'||s[j-3]>'z')&&((j==s.length()-1)||s[j+1]<'a'||s[j+1]>'z'))
                       goto next;
                    
                }
                if(j>2)
                    if((s[j]=='s'&&s[j-1]=='i'&&s[j-2]=='h'&&s[j-3]=='t')||(s[j]=='t'&&s[j-1]=='a'&&s[j-2]=='h'&&s[j-3]=='t'))
                        if((j-4<0||s[j-4]<'a'||s[j-4]>'z')&&((j==s.length()-1)||s[j+1]<'a'||s[j+1]>'z'))
                            goto next;
            }
        }
    next:cout<<s<<endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

string str;

int main() {
	getline( cin, str );
	while ( true ){
		for ( int j = 0; j < str.size(); j++ ) {
			if ( str[ j ] >= 'a' && str[ j ] <= 'z' ) {
				str[ j ]++;
				str[ j ] = ( ( str[ j ] - 'a' ) % 26 ) + 'a';
			}
		}
		bool is_can = false;
		for ( int j = 0; j < str.size() - 2; j++ ) {
			if ( str.substr( j, 3 ) == "the" ) {
				is_can = true;
				break;
			}
		}

		if ( is_can ) {
			break;
		}
		for ( int j = 0; j < str.size() - 3; j++ ) {
			if ( str.substr( j, 4 ) == "that" || str.substr( j, 4 ) == "this" ) {
				is_can = true;
				break;
			}
		}
		if ( is_can ) {
			break;
		}

	}
	printf( "%s\n", str.c_str() );
	return 0;
}

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

int find_cnt;
string find_str;

bool find(string str, string can) {
  string tmp_can = ' ' + can + ' ';
  string tmp_str = ' ' + str + ' ';
  int cnt = 0;
  for (int i = 0; i < tmp_str.length(); ++i) {
    if (string::npos != tmp_str.find(tmp_can, i)) {
      cnt++;
    }
  }
  if (find_cnt < cnt) {
    find_cnt = cnt;
    find_str = str;
  }
  return false;
}

int main() {
  string str;
  string candies[] = {"this", "the", "that"};
  while(getline(cin, str)) {
    find_cnt = 0;
    find_str = "";
  for (int m = 1; m < 26; ++m) {
    for (int i = 0; i < str.length(); ++i) {
      if (str[i] == ' ') {
        continue;
      }
      if (str[i] == ',' || str[i] == '.') {
        str[i] = ' ';
        continue;
      }
      if (m != 1) {
        int char_id = static_cast<int>(str[i]) - 97;
        int shifted = static_cast<int>(char_id + 1);
        str[i] = static_cast<char>(shifted % 26 + 97);
      }
    }
    for (int i = 0; i < sizeof(candies) / sizeof(candies[0]); ++i) {
      find(str, candies[i]);
    }
  }
  if (find_str != "") { 
    cout << find_str << endl;
  }
  }
  return 0;
}