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 <string>

using namespace std;

bool isPlain(string secret){
    bool find_the,find_that,find_this;
    
    find_the = (secret.find("the") != string::npos);
    find_that = (secret.find("that") != string::npos);
    find_this = (secret.find("this") != string::npos);

    return (find_the || find_that || find_this);
}

string decipher(string secret){
    int gap = 1;
    string plain;
    bool check;
    
    //"the", "that", "this"
    check = isPlain(secret);
    
    if(check){
        plain = secret;
    }
    else {
        while(gap<=26){
            string::iterator it = secret.begin();
            for (; it != secret.end(); it += 1){
                if('a'<=*it & *it <='z')
                    *it = (*it!='z') ? *it + 1 : 'a';
                //cout << *it;
            }
            //cout << endl;
            gap++;
            if(isPlain(secret)) break;
        }
    }
    return secret;
}


int main (int argc, char const* argv[]){
    string secret, plain;
    
    
    //暗号文の取得
    getline(cin,secret);
    while(!secret.empty()){
        
        //暗号解読
        plain = decipher(secret);
        //平文の出力
        cout << plain << endl;
        
        getline(cin,secret);
    }
    
    
    return 0;
}

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

using namespace std;

int main()
{
	string str;
	
	while (getline(cin, str)){
		while (1){
			if(str.find("this") != -1 || str.find("the") != -1 || str.find("that") != -1){
           		break;
        	}
		
			for (int i = 0; i < str.size(); i++){
				if (str[i] != ' ' && str[i] != '.'){
					if (str[i] == 'z') str[i] = 'a';
					else str[i]++;
				}
			}
		
		}
		cout << str << endl;
	}
}

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

using namespace std;


int main(){

  string s, strc;

  while(getline(cin,s)){

    for(int j=0;j<26;j++){
      

      if(s.find("the")!=string::npos ||s.find("this")!=string::npos||s.find("that")!=string::npos ){
	cout << s << endl;
      }
      for(int i=0;i<s.size();i++){//size()ツづ債閉カツ篠堋療アツづ個陳キツつウツづーツ陛板つキ
	
	if(s[i]=='z')s[i]='a';
	else if(s[i]>='a'&&s[i]<='z')s[i]++;
      }

    }

  }
  

  return 0;
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000

using namespace std;
typedef long long ll;

string change(string s){
    int len=s.size();
    for(int i=0;i<len;i++){
        if(s[i]=='a')s[i]='z';
        if('b'<=s[i] && s[i]<='z')s[i]--;
    }
    return s;
}

bool check(string s){
    int len=s.size();
    string tan="";
    for(int i=0;i<len;i++){
        if('a'<=s[i] && s[i]<='z'){
            tan+=s[i];
        }
        else{
            if(tan=="the" || tan=="this" || tan=="that" )return true;
            tan="";
        }
    }
    return false;
}


int main(){
    string s;
    while(getline(cin,s)){
        for(int i=0;i<26;i++){
            s=change(s);
            if(check(s)){cout<<s<<endl;break;}
        }
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;


int main(){
  string alp = "abcdefghijklmnopqrstuvwxyz";
  string s;
  while( getline(cin, s) ){
    // cerr << s.size() << endl;
    bool f = false;
    int tmp = 0;
    for(int i=0; i<26; i++){

      for(int j=0; j<s.size()-4; j++){
        if( alp[ (s[j]-'a'+i)%26 ] == 't' && alp[ (s[j+1]-'a'+i)%26 ] == 'h' && alp[ (s[j+2]-'a'+i)%26 ] == 'i' && alp[ (s[j+3]-'a'+i)%26 ] == 's' ){
          f = true;
          break;
        }
        if( alp[ (s[j]-'a'+i)%26 ] == 't' && alp[ (s[j+1]-'a'+i)%26 ] == 'h' && alp[ (s[j+2]-'a'+i)%26 ] == 'a' && alp[ (s[j+3]-'a'+i)%26 ] == 't' ){
          f = true;
          break;
        }
        if( alp[ (s[j]-'a'+i)%26 ] == 't' && alp[ (s[j+1]-'a'+i)%26 ] == 'h' && alp[ (s[j+2]-'a'+i)%26 ] == 'e' ){
          f = true;
          break;
        }
        // if( s[j] == ' ' ) cerr << ' ';
        // else cerr << alp[ (s[j]-'a'+i)%26 ];
      }
      // cerr << endl;
      if( f ){
        // cerr << "  " << i << endl;
        tmp = i;
        break;
      }
    }
    // cerr << tmp << endl;

    for(int i=0; i<s.size(); i++){
      if( s[i] == ' ' || s[i] == '.' ) cout << s[i];
      else cout << alp[ (s[i] - 'a' + tmp)%26 ];
    }
    cout << endl;
  }

  return 0;
}








// EOF

C++: char*p;c[99];
main(){
    for(;~scanf("%[^\n] ",p=c);puts(c))
        for(;(*p++=*p>96?*p%96%26+97:*p)||!strstr(p=c,"th"););
}

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

bool is_valid(const std::string& s) {
	std::string str(" ");
	str.append(s);
	for (int i = 0; i < str.length(); ++i) {
		if (str.at(i) == '.') {
			str[i] = ' ';
		}
	}
	str.push_back(' ');
	
	if (str.find(" the ") != std::string::npos ||
		str.find(" this ") != std::string::npos ||
		str.find(" that ") != std::string::npos) {
		return true;
	}
	return false;
}

int main() {
	std::string str;
	std::getline(std::cin, str);
	
	std::string ans;
	const int limit = 'z' - 'a' + 1;
	for (int i = 0; i < limit; ++i) {
		for (auto c : str) {
			int elem = c + i;
			if (c >= 'a' && c <= 'z') {
				if (elem > 'z') {
					elem = 'a' + elem - ('z' + 1);
				}
				ans.push_back(elem);
			} else {
				ans.push_back(c);
			}
		}
		if (is_valid(ans)) {
			break;
		}
		ans.clear();
	}
	
	std::cout << ans << std::endl;
}

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

int main(void){
    string str;
    while(getline(cin, str)){
        for(int i=0; i<26; i++){
            for(int j=0; j<str.size(); j++){
                if(str[j]!=' ' && str[j]!='.'){
                    str[j]++;
                    if(str[j]>'z') str[j]-=26;
                }
            }
            if(str.find("the")!=string::npos){
                cout<<str<<endl;
                break;
            }else if(str.find("this")!=string::npos){
                cout<<str<<endl;
                break;
            }else if(str.find("that")!=string::npos){
                cout<<str<<endl;
                break;
            }
        }
    }
}