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 <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <stdio.h>

using namespace std;

int pat[3][3];
int len[3];
int chr[3];
int zure;
int size;
bool atteru[3];
char text[100];
char ptext[100];

int main() {
	//cin >> text;
	while (gets(text)) {
		bool flag = false;
		for (int i = 0; i < size; i++) {
			if (text[i] != ptext[i]) break;
			if (i == size-1) flag = true;
		}
		if (flag) break;
	//int size = text.size();
	int pt = 0;
	size = 100;

	pat[0][0] = 't' - 'h';
	pat[0][1] = 'h' - 'e';
	pat[1][0] = 't' - 'h';
	pat[1][1] = 'h' - 'i';
	pat[1][2] = 'i' - 's';
	pat[2][0] = 't' - 'h';
	pat[2][1] = 'h' - 'a';
	pat[2][2] = 'a' - 't';
	chr[0] = 'e';
	chr[1] = 's';
	chr[2] = 't';
	len[0] = 3;
	len[1] = 4;
	len[2] = 4;

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			if (pat[i][j] < 0) pat[i][j] += 26;
		}
	}

	zure = -1;

	int cnt = 0;
	atteru[0] = true;
	atteru[1] = true;
	atteru[2] = true;
	for (int i = 0; i < size-1 && zure == -1; i++) {
		if (text[i] == ' ') {
			cnt = 0;
			atteru[0] = true;
			atteru[1] = true;
			atteru[2] = true;
			//cout << "yarinaoshi!" << endl;
			continue;
		}
		if (text[i+1] == ' ' || cnt > 3) continue;
		int dist = text[i] - text[i+1];
		if (dist < 0) dist += 26;
		for (int j = 0; j <= 2; j++) {
			if (!atteru[j]) continue;
			if (cnt >= len[j]-1) continue;
			if (dist != pat[j][cnt]) {
				atteru[j] = false;
				//cout << j << " ha tigau!" << endl;
				continue;
			} else if (cnt == len[j]-2) {
				if (text[i+2] == ' ') {
					//cout << j << " ha atteta!" << endl;
					zure = text[i+1] - chr[j];
					if (zure < 0) zure += 26;
					//cout << "zure = " << zure << endl;
				} else {
					atteru[j] = false;
					continue;
				}
			}
		}
		cnt++;
	}

	for (int i = 0; i < size; i++) {
		if (text[i] == EOF) break;
		if (text[i] < 'a' || text[i] > 'z') continue;
		text[i] = text[i] - zure;
		if (text[i] < 'a') text[i] += 26;
	}

	cout << text << endl;
	}

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

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

using namespace std;

int main() {
	string abc = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
	string s;
	while (getline(cin, s)) {
		while (true) {
			string::size_type index = s.find("the");
			string::size_type index2 = s.find("this");
			string::size_type index3 = s.find("that");
			if (index != string::npos || index2 != string::npos || index3 != string::npos) {
				break;
			}
			for (int i = 0; i < s.size(); i++) {
				for (int j = 0; j < 26; j++) {
					if (s[i] == abc[j]) {
						s[i] = abc[j+1];
						break;
					}
				}
			}
		}
		cout << s << endl;
	}
	return 0;
}

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

int main() {
	std::string line;
	while (std::getline(std::cin, line)) {
		for (int i = 0; i < 26; i++) {
			if (line.find("the") != std::string::npos || line.find("this") != std::string::npos || line.find("that") != std::string::npos) break;
			for (std::string::iterator itr = line.begin(); itr != line.end(); itr++) {
				if (*itr >= 'a' && *itr <= 'z') {
					*itr = ((*itr - 'a' + 1) % 26) + 'a';
				}
			}
		}
		std::cout << line << std::endl;
	}
}

C++: //Caesar Cipher
#include<bits/stdc++.h>
using namespace std;

int main(){
  vector<string> v;
  string s;
  while(getline(cin, s)){
    stringstream ss(s);
    string tmp;
    v.clear();
    while(getline(ss, tmp, ' ')){
      v.push_back(tmp);
    }
    while(true){
      bool flag=false;
      for(int i=0; i<v.size(); i++){
        for(int j=0; j<v[i].length(); j++){
          if(v[i][j]=='.') continue;
          if(v[i][j]=='z') v[i][j]='a';
          else v[i][j]++;
        }
      }
      for(int i=0; i<v.size(); i++){
        if(v[i]=="this" || v[i]=="that" || v[i]=="the") flag=true;
      }
      if(flag)break;
    }
    for(int i=0; i<v.size(); i++){
      if(i!=v.size()-1) cout << v[i] << ' ';
      else cout << v[i] << endl;
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio( false );

	string tb = "abcdefghijklmnopqrstuvwxyz";
	string s;

	while( getline( cin, s ) ) {
		string t( s.size(), ' ' );

		for( int i = 0; i < tb.size(); ++i ) {
			transform( s.begin(), s.end(), t.begin(), [tb, i]( char c ) {
				return (char)(c >= 'a' && c <= 'z' ? tb[(c-'a' + i) % tb.size()] : c);
			} );

			if( t.find( "the"  ) != string::npos ) { break; }
			if( t.find( "this" ) != string::npos ) { break; }
			if( t.find( "that" ) != string::npos ) { break; }
		}

		cout << t << '\n';
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>

using namespace std;

const double PI=3.14159265;

int main()
{
	string s,t;
	getline(cin,s);

	for(int i=1;i<=26;i++){
		t=s;
		for(unsigned int j=0;j<s.size();j++){
			if(t[j]>='a' && t[j]<='z') t[j]=(t[j]+i)%26+'a';
		}
		if(t.find("the")!=string::npos || t.find("this")!=string::npos
		   ||t.find("that")!=string::npos){
			cout<<t<<endl;
			break;
		}
	}
	return 0;
}

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

using namespace std;

void solve()
{
	string str;
	getline(cin, str);
	string word;
	int n = str.size();
	for(int j = 0; j < 26; ++j)
	{
		word.clear();
		for(int i = 0; i < n; ++i)
		{
			if('a' <= str[i] && str[i] <= 'z')
			{
				word += (str[i] + j -'a') % 26 + 'a';
			}
			else
			{
				word += str[i];
			}
		}
		if(word.find("this") != -1 || word.find("the") != -1 || word.find("that") != -1)
		{
			cout << word << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

int main()
{
    string s;
    while (getline(cin, s))
    {
        for(int n=0; n<26; n++)
        {
            for(int i=0; i<s.size(); i++)
            {
                if(s[i] >= 'a' && s[i] < 'z')
                {
                    s[i]=s[i]+1;
                }
                else if(s[i] == 'z')
                {
                    s[i] = 'a';
                }
                else
                {

                }
            }
            if(  s.find("the")  != std::string::npos
              || s.find("this") != std::string::npos
              || s.find("that") != std::string::npos)
            {
                cout << s << endl;
                break;
            }
        }
    }

    return 0;
}