Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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 scanner.Scan() {
		infos := strings.Split(scanner.Text(), " ")
		plain := make([]string, len(infos))
		// 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++: #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, l;
  string str;

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

    rep(l,26){
      rep(i,N) if(str[i] != '.' && str[i] != ' ') str[i]--;
      rep(i,N) REP(j,i,N){
        if(str.substr(i,j) == "this" || str.substr(i,j) == "the" || str.substr(i,j) == "that"){
          cout << str << endl;
          return 0;
        }
      }
    }
  }

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string s;
  int pl=0;
  while(getline(cin,s)){
    if(s=="\n"&&s=="EOF")  break;
  for(int i =-30;i<30;i++){
    for(int j = 0; j < s.size()-3; j++){
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'e'&& s[j+3]==' '){
        pl = i;
        break;
      }
      if(j==s.size()-1) break;
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'a' && s[j+3]+i=='t' && s[j+4]==' '){
        pl = i;
        break;
      }
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'i' && s[j+3]+i=='s' && s[j+4]==' '){
        pl = i;
        break;
      }
    }
    if(pl!=0) break;
  }
  for(int i=0;i <s.size();i++){
    if(s[i]<='z' && s[i]>='a') s[i] += pl;
  }
  cout<<s<<endl;
  pl=0;
  }
}

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


int main()
{
	string str;
	int len;
	int i,j;
	while(1) {
		getline(cin,str);
		if(cin.eof())
			break;

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

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

using namespace std;


//the this that を探す
bool found(string s){
	if ((s.find("the") != -1) || (s.find("this") != -1) || (s.find("that") != -1))
		return true;
	else
		return false;
}


int main(){

	string str;
	while (getline(cin, str)){

		string ans = str;

		int j = 0;

		while (!found(ans)){
			j++;
			for (int i = 0; i < str.size(); i++){
				if
					(ans[i] == ' ') ans[i] = ans[i];
				else if
					(ans[i] == '.') ans[i] = ans[i];
				else
					ans[i] = ((int)str[i] + j)>(int)'z' ? (char)((int)str[i] + j - 26) : (char)((int)str[i] + j);
			}
			if (found(ans)) break;
		}

		cout << ans << endl;
	}

	return 0;

}

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

int main() {
  string str,s,newstr;
  int key,word;
  vector<string> seq;
  char decode[4],ans;
  while(getline(cin,str)) {
    seq.clear();
    stringstream ss;
    ss << str;
    while(ss >> s) {
      seq.push_back(s);
    }
    ss.str("");
    ss.clear(stringstream::goodbit);

    word = seq.size();
    key = 100;

    for(int i=0;i<word;i++) {

	decode[0] = *seq[i].substr(0,1).c_str();
	decode[1] = *seq[i].substr(1,1).c_str();
	decode[2] = *seq[i].substr(2,1).c_str();
	decode[3] = *seq[i].substr(3,1).c_str();

	for(int j=1;j<27;j++) {
	  for(int k=0;k<4;k++) {
	    decode[k] -= 97; //a-z 0-25
	    decode[k] ++;//1-26
	    decode[k] %= 26;//0-25
	    decode[k] += 97;//97-122
	  }
	  if(decode[0] == 't' && decode[1] == 'h' && decode[2] == 'e') {
	    key = j;
	    break;
	  }
	  if(decode[0] == 't' && decode[1] == 'h' && decode[2] == 'i' && decode[3] == 's') {
	    key = j;
	    break;
	  }
	  if(decode[0] == 't' && decode[1] == 'h' && decode[2] == 'a' && decode[3] == 't') {
	    key = j;
	    break;
	  }
	}
      
      if(key!=100) break;
    }

    for(int i=0;i<word;i++) {
      for(int j=0;j<seq[i].size();j++) {
	ans = *seq[i].substr(j,1).c_str();
	if(ans <= 'z' && 'a' <= ans){
	  ans -= 97;
	  ans += key;
	  ans %= 26;
	  ans += 97;
	}
	cout << ans;
      }
      if(i==word-1) {
	break;
      }
      cout << " ";
      
    }
    cout << endl;
  }
}

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

typedef pair<string, string> P;

P next_word(string sentence) {
  if (sentence.empty()) return make_pair(string(""), string(""));
  if (sentence[0] == ' ' || sentence[0] == '.') {
    return make_pair("", sentence.substr(1));
  } else {
    P recur = next_word(sentence.substr(1));
    return make_pair(sentence[0] + recur.first, recur.second);
  }
}

bool acceptable(string sentence) {
  P p = next_word(sentence);

  while (! p.first.empty() ) {
    if (p.first == "this" || p.first == "the" || p.first == "that")
      return true;

    p = next_word(p.second);
  }
  return false;
}

char slip(char c) {
  if (c < 'a' || 'z' < c) return c;
  
  string alphabet = "abcdefghijklmnopqrstuvwxyza";
  int index = (int)(c - 'a');
  return alphabet[index + 1];
}

char slip(char c, int n) {
  for (int i = 0; i < n; i++)
    c = slip(c);

  return c;
}

string slip(string code, int n) {
  string val;
  for (int i = 0, len = code.length(); i < len; i++)
    val += slip(code[i], n);

  return val;
}

string decode(string code) {
  for (int i = 1; i < 27; i++) {
    string sentence = slip(code, i);
    if (acceptable(sentence))
      return sentence;
  }

  return "";
}

int main() {
  string code;
  while ( getline(cin, code) )
    cout << decode(code) << endl;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
int main(void){

	int i,j;
	char str[256];	

	while(fgets(str,sizeof(str),stdin)!=NULL){				
		
		while(1){
			for(i=0;i<sizeof(str);i++){
				
				if(str[i]=='\0'){
					break;
				}
				
				if(isalpha(str[i])){
					if(islower(str[i])){
						if(str[i]=='z'){
							str[i]='a';
						}else{
							str[i]=str[i]+1;
						}
					}
					else if(isupper(str[i])){
						if(str[i]=='Z'){
							str[i]='A';
						}else{
							str[i]=str[i]+1;
						}
					}
				}
			}
			if(strstr(str,"the")!=NULL || strstr(str,"this")!=NULL || strstr(str,"that")!=NULL){
				printf("%s",str);
				break;
			}
			
		}
		
	}
	return 0;
	
}