Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func incrementByte(b byte) byte {
	if b >= 97 && b < 122 {
		return b + 1
	} else if b == 122 {
		return 97
	}
	return b
}

func main() {
	scanner.Split(bufio.ScanLines)

	for {
		line := nextString()
		if len(line) == 0 {
			break
		}
		for i := 0; i <= 26; i++ {
			decoded := []byte{}
			for j := 0; j < len(line); j++ {
				decoded = append(decoded, incrementByte(line[j]))
			}
			line = string(decoded)
			if strings.Contains(line, "the") || strings.Contains(line, "this") || strings.Contains(line, "that") {
				fmt.Println(line)
				break
			}
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

int main()
{
	string str;
	while(getline(cin,str)){
		for(int rot = 0;rot< 'z' - 'a' + 1;rot++){
			string tmp = str;
			for(int i=0; i<str.size() - 1; i++){
				if(tmp[i] == ' ') continue;
				tmp[i] = (rot + tmp[i]-'a') % ('z' - 'a' + 1) + 'a';
			}
			//cout << tmp << endl;
			if(tmp.find("the") != string::npos
				|| tmp.find("this") != string::npos
				|| tmp.find("that") != string::npos)
			{
				cout << tmp << endl;
				continue;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	int res=0;
	vector<string> buf;
	string str;
	while((cin>>str)!=NULL)
		buf.push_back(str);
	for(int ptr=0;ptr<buf.size();++ptr){
		if(res!=0) break;
		if(buf[ptr].length()>2)
		if(buf[ptr][0]-buf[ptr][1]=='t'-'h'){
			int dif='t'-buf[ptr][0];
			string tmp;
			for(int i=0;i<buf[ptr].length();++i)
				tmp += (buf[ptr][i]=='.'?'.':(buf[ptr][i]-'a'+dif)%26+'a');
			if(tmp=="the" or tmp=="this" or tmp=="that" or tmp=="this." or tmp=="that."){
				res = dif;
				break;
			}
		}
		cout<<1;
	}
	if(res!=0){
		for(int ptr=0;ptr<buf.size();++ptr){
			string tmp;
			for(int i=0;i<buf[ptr].length();++i)
				tmp += ((buf[ptr][i]=='.') ? '.' : (buf[ptr][i]-'a'+res)%26+'a');
			cout<<tmp<<(ptr==buf.size()-1?"":" ");
		}
	}
	if(res==0) cout<<"-1";
	cout<<endl;
	return 0;
}

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

using namespace std;


int main(){
	string line;

	while(getline(cin, line)){
		int flag;

		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<line.size() ; j++){
				if(line[j] != ' ' && line[j] != '.'){
					if((line[j]-1) < 'a'){
						line[j] = line[j] +1 -'a' + 'z' ;
					}else{
						line[j]--;
					}
				}
			}

			for(int k=0 ; k<line.size()-1 ; k++){
				if(line[k] == 't' && line[k+1] == 'h'){
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}
		cout << line << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#define INF 1000000000

using namespace std;

// the this that

int main() {
	string str;
	getline(cin, str);
	string tmp = "";
	int len = 0, key;
	for (int i=0; i<str.length(); i++) {
		if (str[i] == ' ' && len == 4) {
			if (tmp[0]-'t'==tmp[1]-'h'&&tmp[1]-'h'==tmp[2]-'i'&&tmp[2]-'i'==tmp[3]-'s') {
				key = tmp[0]-'t';
				break;
			} else if (tmp[0]-'t'==tmp[1]-'h'&&tmp[1]-'h'==tmp[2]-'a'&&tmp[2]-'a'==tmp[3]-'t') {
				key = tmp[0]-'t';
				break;
			}
			tmp = ""; len = 0;
		} else if (str[i] == ' ' && len == 3) {
			if (tmp[0]-'t'==tmp[1]-'h'&&tmp[1]-'h'==tmp[2]-'e') {
				key = tmp[0]-'t';
				break;
			}
			tmp = ""; len = 0;
		} else {
			tmp += str[i];
			len++;
		}
	}
	for (int i=0; i<str.length(); i++) {
		if (isalpha(str[i])) {
			str[i] -= key;
			if (str[i]>'z') str[i] -= 48;
			else if (str[i]<'a') str[i] += 48;
		}
	}
	cout << str << endl;
}

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

int main(){
	string str, str_copy;
	
	while(getline(cin, str)){
		for(int i = 0; i < 26; i++){
			for(int j = 0; j < str.size(); j++){
				if(str[j] >= 'a' && str[j] <= 'z'){
					str[j] = (str[j] == 'z')? 'a' : str[j] + 1;
				}
			}
			if(str.find("the") != string::npos
			 || str.find("this") != string::npos
			  || str.find("that") != string::npos){
				cout << str << endl;
			}
		}
	}
	
	return 0;
}

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 <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;


int main(){
	string tmp;
	string key[] = {"the","this","that"};
	int alfabet;
	bool clearFlag;
	while(getline(cin,tmp) && tmp != "END OF INPUT"){
		clearFlag = false;
		alfabet = 26;
		while(alfabet--){

			for(string::iterator it = tmp.begin(); it != tmp.end(); it++){
				if(*it >= 'a' && *it <= 'z'){
					(*it)++;
					if(*it >= 'z'){
						*it = 'a';
					}
				}
			}
			for(int j = 0; j < 3; j++){
				if(tmp.find(key[j]) != string::npos){
					cout << tmp << endl;
					clearFlag = true;
					break;
				}
			}

			if(clearFlag == true){
				break;
			}

		}

	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  string s;
  getline(cin,s);
  for(int i=0; i<26; i++){
    for(int j=0; j<s.size(); j++){
      if(s[j]<'z' && s[j]>='a') s[j]++;
      else if(s[j] == 'z') s[j] = 'a';
    }
    if(s.find("the") != string::npos){cout <<s<<endl;break;}
    if(s.find("that") != string::npos){cout <<s<<endl;break;}
    if(s.find("this") != string::npos){cout <<s<<endl;break;}
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main(){
	string alpha = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
	while( 1 ){
		string str;
		getline( cin, str );
		for( int a = 0; a < 26; a++ ){
			for( int i = 0; i < str.length(); i++ ){
				for( int j = 0; j < alpha.length(); j++ ){
					if( str[i] == alpha[j] ){
						str[i] = alpha[j + 1];
						break;
					}
				}
			}
		/*char word = strtok( str.c_str(), " " );
		if( word == "the" || word == "that" || word == "this" ) break;
		while( word == NULL ){
			word = strtok( NULL, ' ' );
			if( word == "the" || word == "that" || word == "this" ) goto end;
		}*/
			if( str.find("the") != string::npos || str.find("this") != string::npos || str.find("that") != string::npos ){
				break;
			}
		}
		cout << str << endl;
	}
}