Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

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 {
		infos := strings.Split(nextString(), " ")
		plain := make([]string, len(infos))
		if reflect.DeepEqual(infos, []string{}) {
			break
		}
		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 <string>
using namespace std;

bool check(string w, string f) {
    if(w.find(f) != string::npos) return true;
    return false;
}

int main() {
    string s, w;
    while(getline(cin, s)) {
        for(int i = 0; i < 26; i++) {
            w = s;
            for(int j = 0; j < s.size(); j++) {
                if(w[j] >= 'a' && w[j] <= 'z') {
                    w[j] = char((w[j] + i - 'a') % 26 + 'a');
                }
            }
            if(check(w, "the") || check(w, "this") || check(w, "that")) {
                cout << w << endl;
                break;
            }
        }
    }
}

C++: xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.

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