Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		var result string
		line := scanner.Text()
		key := make(map[string]string)

		var i int32
		for ; i < 52; i++ {
			makeKey(key, i)
			result = decode(key, line)

			if strings.Contains(result, "the") {
				break
			} else if strings.Contains(result, "this") {
				break
			} else if strings.Contains(result, "that") {
				break
			}
		}

		fmt.Println(result)
	}
}

func makeKey(key map[string]string, shift int32) {
	for i := 'a'; i <= 'z'; i++ {
		cipher := (i + shift)
		if cipher > 'z' {
			cipher = cipher%'z' + 'a' - 1
		} else if cipher < 'a' {
			cipher = cipher + ('z' - 'a') + 1
		}
		key[string(i)] = string(cipher)
	}
}

func decode(key map[string]string, cipher string) string {
	var result string
	for _, v := range cipher {
		if key[string(v)] != "" {
			result += key[string(v)]
		} else {
			result += string(v)
		}
	}
	return result
}

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

/*他人のパクリ　アスキーコードの文字から数値への変換が出来なかった*/
int main() {
	string ac;
	while (getline(cin, ac)) {
		while ((ac.find("the") == -1) && (ac.find("this")==-1) && (ac.find("that") == -1)) {
			for (int i = 0; i < ac.size(); i++) {
				if ('a' <= ac[i] && ac[i] < 'z') {
					ac[i] += 1;
				}
				else if (ac[i]=='z'){
					ac[i] = 'a';
				}
			}

		}
		cout << ac << endl;
	}
	return 0;
}

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

int main(void){
  int len, cnt;
  string str;

  while(getline( cin, str )){
    len = str.length();
    cnt = 0;

    while(true){
      if( str.find("the", 0) != string::npos
	  || str.find("this", 0) != string::npos 
	  || str.find("that", 0) != string::npos
	)
	break;
      for(int i = 0; i < len; i++){
	if( 'a' <= str[i] && str[i] <= 'z' ){
	  str[i]++;
	  if(str[i] > 'z')
	    str[i] = 'a';
	}
      }
      
      cnt++;
      if(cnt > 30)
	break;
    }
    
    cout << str << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
bool isAlpha(char c){
	return ('a' <= c && c <= 'z');
}
char getShift(char c, int v){
	if (0 == v) return c;
	return char('a' + int(c + v + 26 - 'a') % 26);
}
int getShiftIndex(string& line){
	int s = line.size();
	string::size_type ps = 0, pe = 0;
	while (true){
		while (ps < s && !isAlpha(line[ps])) ++ps;
		pe = ps;
		while (pe < s && isAlpha(line[pe])) ++pe;
		if (ps >= s || pe >= s)
			break;
		int len = pe - ps;
		if (3 == len){
			if(	   line[ps] == getShift(line[ps + 1], 12)
				&& line[ps] == getShift(line[ps + 2], 15))
				return int('t' - char(line[ps]));
		}
		else if (4 == len){
			if(	   line[ps] == getShift(line[ps + 1], 12)
				&& line[ps] == getShift(line[ps + 2], 11)
				&& line[ps] == getShift(line[ps + 3], 1))
				return int('t' - char(line[ps]));
			if (   line[ps] == getShift(line[ps + 1], 12)
				&& line[ps] == getShift(line[ps + 2], 19)
				&& line[ps] == getShift(line[ps + 3], 0))
				return int('t' - char(line[ps]));
		}
		ps = pe;
	}
	return -1;
}

int main()
{
	string line;
	while (std::getline(cin, line)){
		int s = line.size();
		int v = getShiftIndex(line);
		for (int i = 0; i < s; ++i){
			char c = line[i];
			if (isAlpha(c)) cout << getShift(c, v);
			else cout << c;
		}
		cout << "\n";
	}
	return 0;
}

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;


int main ()
{
	string str , str2;
	vector<string>data;
	while( getline ( cin , str2 ) )
	{
		data.push_back ( str2 );
	}
	for( size_t i = 0; i < 26; i++ )
	{
		for( auto &y : data )
		{
			for( auto &x : y )
			{
				if( x <= 'z'&&'a' <= x )
				{
					x -= 'a';
					x += 1;
					x %= 26;
					x += 'a';
				}
			}
			
			if( y.find ( "the" ) != string::npos || y.find ( "this" ) != string::npos || y.find ( "that" ) != string::npos )
			{
				for( auto P : data )
				{
					cout << P << endl;
				}
				return 0;
			}
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
	string S;
	while( getline( cin, S ) )
	{
		while( true )
		{
			REP( i, (int)S.size() )
			{
				if( S[ i ] != ' ' && S[ i ] != '.' )
				{
					if( S[ i ] == 'z' )
					{
						S[ i ] = 'a';
						continue;
					}
					S[ i ]++;
				}
			}
			if( S.find( "the" ) != string::npos || S.find( "this" ) != string::npos || S.find( "that" ) != string::npos )
			{
				break;
			}
		}
		cout << S << endl;
	}
	return 0;
}

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

int main(){
    string str;
    
    while(getline(cin,str)){
        int flg = 0;
        
        while(true){
            for(int i = 0 ; i < str.length() ; i++){
                string key1 = str.substr(i,3),key2 = str.substr(i,4);
                if(key1 == "the" || key2 == "that" || key2 == "this") flg = 1;
            }
            
            if(flg) goto end;
            else{
                for(int j = 0 ; j < str.length() ; j++){
                    if('a' <= str[j] && str[j] <= 'z'){
                        str[j] -= 'a' - 'A';
                        str[j] = (char)('A'+(str[j]-'A'+26+1)%26);
                        str[j] += 'a' - 'A';
                    }
                    else continue;
                }
            }
        }
    }
    end:
    cout << str << endl;
    
    return 0;
}

C++: #include <iostream>
#include <string.h>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
	char st[80];
	string w[3]={"the","this","that"};
	int wn[3]={3,4,4},k,i,j,s,f,z;
	while(true) {
    k=0; z=0;
	scanf("%[^0]",st);
	z=strlen(st);
	while(k<z) {
		for (i=0;i<3;i++) {
			s=0; f=0;
			if (z<k+wn[i]) break;
			for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
			if (s==wn[i]-1 && (st[k+wn[i]]<'a' || st[k+wn[i]]>'z' ))  { f=1; i=5;}
		}
		if (f==1) break;
		for (k;st[k]>='a' && st[k]<='z';k++);
		k++;
		}
	if (f==0) cout << st; else {
	for (i=0;i<z;i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
	  }	
	}
    return 0;
	}