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 <iostream>
#include <string>

const char *table = "abcdefghijklmnopqrstuvwxyz";

inline char shift(char c, int n)
{
    return table[(c - 'a' - n) % 26];
}

void shift(std::string &s, int n)
{
    for (unsigned i = 0; i < s.size(); ++i) {
        if (s[i] != ' ' && s[i] != '.') s[i] = shift(s[i], n);
    }
}

int search_number(const std::string &s)
{
    for (unsigned i = 0; i < s.size() - 3; ++i) {
        int n = s[i] - 't';
        if (shift(s[i + 1], n) == 'h') {
            if (shift(s[i + 2], n) == 'e'
                    || (i < s.size() - 3 && shift(s[i + 2], n) == 'i' && shift(s[i + 3], n) == 's')
                    || (i < s.size() - 3 && shift(s[i + 2], n) == 'a' && shift(s[i + 3], n) == 't'))
                return n;
        }
    }
    return s[s.size() - 3] - 't';
}

int main()
{
    std::string s;
    while (getline(std::cin, s)) {
        shift(s, search_number(s));
        std::cout << s << std::endl;
    }
}

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

using namespace std;
int main(){
	string str1;
	int i, j, n = 0;
	while(getline(cin, str1)){
		bool change = false;
		for(i = 0;i < 26;i++){
			for(j = 0;j < str1.size();j++){
				if(str1[j] != ' ' && str1[j] != '.'){
					str1[j] -= 1;
				}
			}
			for(j = 0;j+3 < str1.size();j++){
				if(str1[j] == 't' && str1[j+1] == 'h'){
					if(str1[j+2] == 'e' || (str1[j+2] == 'i' && str1[j+3] == 's') || (str1[j+2] == 'a' && str1[j+3] == 't')){
						n = i + 1;
						change = true;
						break;
					}
				}
			}
			if(change) break;
		}	
		for(i = 0;i < str1.size();i++){
			cout << str1[i];
		}
		cout << endl;
	}


	return 0;
}

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

using namespace std;

const string LIST[3] = {"the", "this", "that"};

bool judge(string);

int main(void){
	for(string input; getline(cin, input); cout << input << endl){
		for(int i = 0; i < 25; i ++){
			if(judge(input)) break;
			for(int j = 0; j < input.length(); j ++){
				if('a' <= input[j] && input[j] <= 'z')
					input[j] = (input.at(j) != 'z') ? input.at(j) + 1: 'a';
			}
		}
	}

	return 0;
}

bool judge(string input){
	istringstream iss(input);
	do{
		string sub;
		iss >> sub;
		for(int i = 0; i < 3; i ++)
			if(sub == LIST[i]) return true;
	} while(iss);

	return false;
}

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

using namespace std;

char Shift(int, char);

int main(){
  int i, n;
  string str, _str;
  string The = "the", This = "this", That = "that";
  string::iterator iter1, iter2, iter3;

  while(getline(cin, str)){
    n=1;
    while(1){
      _str = str;
      for(i=0; i<_str.size(); i++)
	_str[i] = Shift(n, _str[i]);

      iter1 = search(_str.begin(), _str.end(), The.begin(), The.end());
      iter2 = search(_str.begin(), _str.end(), This.begin(), This.end());
      iter3 = search(_str.begin(), _str.end(), That.begin(), That.end());

      if(iter1 != _str.end() || iter2 != _str.end() || iter3 != _str.end())
	break;

      n++;
    }

    cout << _str << endl;
  }

  return 0;
}

char Shift(int n, char c){
  int x;
  if(c >= 'a' && c <= 'z'){
    x = c + n;
    if(x > 122) x -= 26;
    c = x;
  }
  return c;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	string str[1000];
	int num=0;
	int k=0;
	while(cin>>str[k]){
		for(int j=0;j<26;j++){
			string str2 = str[k];
			for(int i=0;i<str2.size();i++){
				int cnt=j;
				while(cnt){
					if(str2[i]=='a'){
						str2[i]='z';
					}else{
						str2[i]--;
					}
					cnt--;
				}
			}
//			if(k==0) cout<< str2<<endl;
			if(str2=="the" || str2=="this" || str2=="that"){
				num = j;
				break;
			}
		}
		k++;
	}
	for(int j=0;j<k;j++){
		for(int i=0;i<str[j].size();i++){
			int cnt = num;
			while(cnt){
				if(str[j][i]=='.'){
				}else if(str[j][i]=='a'){
					str[j][i]='z';
				}else{
					str[j][i]--;
				}
				cnt--;
			}
		}
		cout<<str[j];
		if(j!=k-1){
			cout<<" ";
		}else{
			cout<<endl;
		}
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, j, c;
  string str;

  while(getline(cin,str)){
    int N = str.size();

    rep(c,26){
      rep(i,N) if(str[i] != '.' && str[i] != ' '){
          str[i]--;
          if(str[i] < 'a') str[i] = 'z';
      }
 
      rep(i,N){
        if(str.find("this") != -1 || str.find("the") != -1 || str.find("that") != -1){
          cout << str << endl;
          return 0;
        }
      }
    }
  }

  return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
  string str, copy;
  int shif;
  vector<string> result;
  while (getline(cin, str)) {
    copy = str;
    shif = -1;
    while (true) {
      if (str.find(" this ") != string::npos ||
          str.find(" that ") != string::npos ||
          str.find(" the ") != string::npos)
        break;
      else
        for (string::iterator itr = str.begin();
             itr != str.end();
             itr++)
          if ('a' <= *itr && *itr <= 'z') {
            *itr += shif;
          } else if (*itr != '.' && *itr != ' ' &&
                     *itr != '\n') {
            str = copy;
            shif = 1;
            break;
          }
    }
    result.push_back(str);
  }

  for (int i = 0; i < result.size(); i++)
    cout << result[i] << endl;
  return 0;
}