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

using namespace std;

int main(int argc, const char * argv[])
{
    int shift = 0, i=0;
    string in,out;
    getline(cin,in);
    out = in;
    do {
        for (i=0; i<in.length(); i++) {
            if (in[i]!=' '&&in[i]!='.') {
                out[i] = ((in[i] - 'a' + shift) % 26) + 'a';
            }
        }
        if (out.find(" the ")!=std::string::npos||out.find(" that ")!=std::string::npos||out.find(" this ")!=std::string::npos||out.find("the ")!=std::string::npos||out.find("this ")!=std::string::npos||out.find("that ")!=std::string::npos||out.find(" the.")!=std::string::npos||out.find(" this.")!=std::string::npos||out.find(" that.")!=std::string::npos) {
            break;
        }
        else
            shift++;
    } while (1);
    
    cout<<out;
    return 0;
}

C++: #include <bits/stdc++.h>

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

inline std::vector<std::string> Split_String(const std::string &str, const char key) {

	std::vector<std::string> result;
	std::stringstream SS(str);
	std::string temp;

	while (std::getline(SS, temp, key)) {
		result.push_back(temp);
	}

	return(result);

}

inline std::string Decode_CaesarCipher(const std::string &cryptogram, const int shift) {

	std::string temp = cryptogram;
	for (unsigned int i = 0; i < temp.length(); i++) {
		if (65 <= temp[i] && temp[i] <= 90) {
			temp[i] = temp[i] - shift;
			if (temp[i] < 65) {
				temp[i] += 26;
			}

		}
		else if (97 <= temp[i] && temp[i] <= 122) {
			temp[i] = temp[i] - shift;
			if (temp[i] < 97) {
				temp[i] += 26;
			}
		}
	}

	return(temp);
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	std::string temp, th;
	std::vector<std::string> split, len3, len4, ans;

	while (std::getline(std::cin, temp)) {

		//??????????????§?????????????????????
		split = Split_String(temp, ' ');
		
		for (unsigned int i = 0; i < split.size(); i++) {

			//?????????????????????
			if (split[i].find(".", 0) != std::string::npos) {
				split[i].erase(split[i].begin() + split[i].find(".", 0));
			}

			//3??????/?????????????????????????????????
			switch (split[i].length()) {
			case 3:len3.push_back(split[i]); break;
			case 4:len4.push_back(split[i]); break;
			}
		}

		//3??????????????¨???????????????????????????????????´???????????????????????¢???(?????????"t"????£?)
		for (unsigned int i = 0; i < len3.size(); i++) {
			for (unsigned int j = 0; j < len4.size(); j++) {
				if (len3[i].substr(0, 2) == len4[j].substr(0, 2)) {
					if (th.find(len3[i][0], 0) == std::string::npos) {
						th.push_back(len3[i][0]);
					}
				}
			}
		}

		//t????£???????????????°???????????????3??????????????§"the"?????§???????????????
		int shift = 0;
		for (unsigned int i = 0; i < th.length(); i++) {
			if ('t' <= th[i]) {
				shift = th[i] - 't';
			}
			else {
				shift = th[i] - 't' + 26;
			}
			for (unsigned int j = 0; j < len3.size(); j++) {
				if (Decode_CaesarCipher(len3[i], shift) == "the") {
					j = len3.size();
					i = th.length();
				}
			}
		}

		//???????????????????´?
		ans.push_back(Decode_CaesarCipher(temp, shift));

		//?¬???±??????
		temp.clear(); th.clear();
		split.clear(); len3.clear(); len4.clear();
	}

	//????????????
	for (unsigned int i = 0; i < ans.size(); i++) {
		std::cout << ans[i] << std::endl;
	}


}

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

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 

int main(void){  
  vector<string> words;
  string bf;
  int s = 0;
  while(cin>>bf) words.push_back(bf);
  REP(i,words.size()){
    if(words[i].size()==3||words[i].size()==4){
      REP(j,26){
        REP(k,words[i].size()){
          words[i].replace(k, 1, 1,
              'a' + ( words[i][k] + 1 - 'a')%('z'-'a'+1) );
        }
        if(words[i] == "the"||words[i] == "this" || words[i] == "that")
          s = j;
      }
    }
  }
  REP(i,words.size())
    REP(j,words[i].size())
      if(words[i][j] >= 'a' && words[i][j] <= 'z' )
        words[i].replace(j, 1, 1, 'a' + (words[i][j] + s+1 - 'a')%('z'-'a'+1) );
  cout << words[0];
  FOR(i,1,words.size())
    cout << " " << words[i];
  cout << endl;
}

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

void next(string& str)
{
	for(int i=0; i<str.length(); i++)
	{
		if('a'<=str[i] && str[i]<'z')
		{
			str[i] = ((str[i]-'a'+25)%26)+'a';
		}
	}
}

int main()
{
	string str;
	while(getline(cin,str))
	{
		for(int i=0; i<26; ++i,next(str))
		{
			if(-1!=str.find("the") || -1!=str.find("this") || -1!=str.find("that"))
			{
				cout << str << endl;
				break;
			}
		}
	}

	return 0;
}

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

int main(){
  int index ,flag=0 ,temp= 'z' - '`' ,cnt=0;
  string s ,key[3]={ "the" ,"this" ,"that" };

  while( true ){
    flag = 0;
    getline( cin ,s );
    if( cin.eof() ){
      break;
    }

    while( true ){
      for( int i=0 ; i<s.length()+1 ; i++ ){ // シーザー暗号を戻す
	if( s[i] != '.' && s[i] != ' ' && s[i] != '\n' ){ //　記号はスルー
	  s[i]--;
	  if( s[i] < 'a' ){ // aからzに飛ばす
	    s[i] += temp; 
	  }
	}
      }

      for( int i=0 ; i<3 ; i++ ){
	index = s.find( key[i] ,0 ); // the ,this ,that を探す
	if( index != string::npos ){ // あった
	  cout << s << endl;
	  flag = 1;
	  break;
	}
      }
      cnt++;
      if( cnt == 26 ){
	break;
      }

      if( flag == 1 ){
	break;
      }
    }
  }
}

C++: #include <stdio.h>
#include <string.h>

void shift(char *str, int len, int n){
	char t[] = "abcdefghijklmnopqrstuvwxyz";
	char c;
	for(int i=0; i<len; ++i){
		c = *(str + i);
		if(c >= 'a' && c <= 'z'){
			str[i] = t[(c-'a'+n)%26];
		}
	}
}

int main(void){
	char input[81];
	char copy[81];
	char *token;
	int len = 0;
	int n = 0;

	while(fgets(input, 80, stdin) != NULL){
		n = -1;
		strcpy(copy, input);

		token = strtok(copy, " .\n");
		while(token != NULL && n == -1){
			len = strlen(token);
			if(len == 4){
				for(int i=0;i<26; ++i){
					shift(token, 4, 1);
					if(strcmp(token, "this")==0 ||
						strcmp(token, "that")==0){
						n = i + 1;
						break;
					}
				}
			}else if(len ==3){
				for(int i=0;i<26; ++i){
					shift(token, 3, 1);
					if(strcmp(token, "the")==0){
						n = i + 1;
						break;
					}
				}
			}
			token = strtok(NULL, " .\n");
		}
		shift(input, strlen(input), n);
		printf(input);
	}
	return 0;
}