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;

int checkCaesarChipher(string str1, string str2){
	int a[100],b[100];
	bool flag = false;
	
	for(unsigned int i=0 ; i<str1.size()-1 ; i++){
		a[i] = (str1[0] - str1[i] + 26 - 'a') % 26;
		b[i] = (str2[0] - str2[i] + 26 - 'a') % 26;
		if(a[i]==b[i]){
			flag = true;
		}else{
			flag = false;
			break;
		}
	}
	if(flag){
		return (str2[0] - str1[0]);
	}else{
		return 0;
	}
}

int main(){
	string str[40];
	int i=0, ans=0;
	while(cin >> str[i]){
		if(str[i] == "hoge") break;
		
		i++;
	}
	for(int j=0 ; j<i ; i++){
		ans = 0;
		if(str[j].size()==3){
			string hoge1 = "the";
			if(checkCaesarChipher( hoge1 , str[j] )!=0){
				ans = checkCaesarChipher( hoge1 , str[j] );
				break;
			}
		}
		if(str[j].size()==4){
			string hoge2 = "that";
			if(checkCaesarChipher( hoge2 , str[j] )!=0){
				ans = checkCaesarChipher( hoge2 , str[j] );
				break;
			}
			string hoge3 = "this";
			if(checkCaesarChipher( hoge3 , str[j] )!=0){
				ans = checkCaesarChipher( hoge3 , str[j] );
				break;
			}
		}
	}
	if(ans!=0){
		for(int j=0 ; j<i ; j++){
			for(unsigned int k=0 ; k<str[j].size() ; k++){
				if(str[j][ str[j].size()-1] != '.'){
					str[j].at(k) -= ans;
				}
			}
			cout << str[j] << " ";
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <sstream>      // std::ostringstream
std::vector<std::string> split(const std::string &str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}
using namespace std;
int main() {
	string str;
	string w[3] = { "the","this",  "that" };
	while (true) {
		getline(cin, str);

		if (str == "")break;

		vector<string> v = split(str, ' ');

		int key;
		bool f = false;

		//v[v.size() - 1].pop_back();

		for (int i = 0; i < v.size();i++) {
			for (int j = 1; j < 26;j++) {
				string temp;
				for (int k = 0; k < v[i].size();k++) {
					temp += (v[i][k] - 'a' + j) % 26 + 'a';
				}
				for (int k = 0; k < 3;k++) {
					if (temp == w[k]) {
						f = true;
						key = j;
						break;
					}
				}
				if (f)break;
			}
			if (f)break;
		}

		for (int i = 0; i < v.size();i++) {
			for (int k = 0; k < v[i].size();k++) {
				cout << char((v[i][k] - 'a' + key) % 26 + 'a');
			}
			if (i != v.size() - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <regex>
#include <cctype>
#include <string>
#include <utility>
using namespace std;

vector<string> v;

vector<string> split(string&& s, regex&& pattern) {
    sregex_token_iterator first(s.begin(), s.end(), pattern, -1);
    sregex_token_iterator last;
    return(vector<string>(first, last));
}

bool cheser() {
    for(int r = 1; r <= 26; r++) {
        bool found = false;
        for(int c = 0; c < v.size(); c++) {
            for(int k = 0; k < v[c].length(); k++) {
                if(!isalpha(v[c][k])) continue;
                int now = v[c][k] - 'a';
                now = (now+1)%26;
                v[c][k] = 'a' + now;
            }
            if(v[c] == "the" || v[c] == "this" || v[c] == "that") found = true;
        }
        if(found) return(true);
    }
    return(false);
}

int main(void) {
    string input;
    while(getline(cin, input)) {
        v = split(move(input), regex(" "));
        cheser();
        for(int r = 0; r < v.size(); r++) {
            cout << v[r];
            if(r == v.size() - 1) cout << endl;
            else                  cout << " ";
        }
    }
    
    return(0);
}

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

int find_cnt;
string find_str;

bool find(string str, string can) {
  string tmp_can = can;
  string tmp_str = str;
  int cnt = 0;
  for (int i = 0; i < tmp_str.length(); ++i) {
    if (string::npos != tmp_str.find(tmp_can, i)) {
      cnt++;
    }
  }
  if (find_cnt < cnt) {
    find_cnt = cnt;
    find_str = str;
  }
  return false;
}

int main() {
  string str;
  string candies[] = {"this", "the", "that"};
  while(getline(cin, str)) {
    find_cnt = 0;
    find_str = "";
  for (int m = 1; m < 26; ++m) {
    for (int i = 0; i < str.length(); ++i) {
      if (str[i] == ' ') {
        continue;
      }
      if (str[i] == ',' || str[i] == '.') {
        str[i] = ' ';
        continue;
      }
      if (m != 1) {
        int char_id = static_cast<int>(str[i]) - 97;
        int shifted = static_cast<int>(char_id + 1);
        str[i] = static_cast<char>(shifted % 26 + 97);
      }
    }
    for (int i = 0; i < sizeof(candies) / sizeof(candies[0]); ++i) {
      find(str, candies[i]);
    }
  }
  if (find_str != "") { 
    cout << find_str << endl;
  }
  }
  return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
	string str;
	while(getline(cin,str)){
		for(int j=0;j<=26;j++){
			for(int i=0;i<str.size();i++){
				if(str[i]>='a' && str[i] <='z'){
					if(str[i] != 'z'){
						str[i]+=1;
					}else{
						str[i] = 'a';
					}
				}
			}
			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<string>
#include<vector>
using namespace std;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define pb(a) push_back(a)

char in(char data){
  if(data < 'a' || 'z' < data)return data;
  if('z' == data){
    return 'a';
  }else{
    return ++data;
  }
}
int main(void){
  string str;
  vector<string> pa;
  getline(cin,str);
  str+= " ";
  string w;
  for(int i = 0 ; i < str.size() ; i ++){
    if(str[i] == ' '){
      pa.pb(w);
      w="";
    }else{
      w+=str[i];
    }
  }
  string t[3] = {"this","the","that"};
  while(true){
    vector<string> after;
    bool find = false;
    rep(i,pa.size()){
      rep(j,3){
	if(pa[i] == t[j])find = true;
      }
      w = "";
      rep(j,pa[i].size()){
	w += in(pa[i][j]);
      }
      after.pb(w);
    }
    if(find)break;
    pa=after;
  }
  rep(i,pa.size())cout<<pa[i]<<" ";
  cout<<endl;
}