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 <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    char in[100];
    string S;
    vector<string> vec;
    
    while(EOF!=scanf("%s",in)){
        
        S = in;
        vec.push_back(S);
    }
    
    for(int k=0;k<26;k++){
        
        bool f = false;
        
        for(int i=0;i<vec.size();i++){
            for(int j=0;j<vec[i].size();j++){
                if(vec[i][j]!='.')vec[i][j]++;
                
                if(vec[i][j] > 'z') vec[i][j]='a';
            }
            
            if(vec[i]=="the" || vec[i]=="that" || vec[i]=="this"){
                
                f = true;
                
            }
        }
        
        if(f) break;
    }
    
    for(int i=0;i<vec.size();i++){
        cout << vec[i];
        if(i == vec.size()-1) cout << endl;
        else cout << " ";
    }
    
    return 0;
}

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

int main(){
	int i, j;
	string s;
	while(getline(cin, s)){
		for (i = 0; i < 26; i++) {
			for(j = 0; j < s.length(); j++){
				if(s[j] != '.' && s[j] != ' '){
					s[j] = (s[j]=='a')? 'z' : s[j] - 1;
				}
			}
			if(s.find("the")!=string::npos || s.find("this")!=string::npos || s.find("that")!=string::npos){
				cout << s << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
//????????????????????????????????????
void Check(const string& str){
  string strparent=str;
  int gap=1;
  while(strparent.find("the")==(string::npos)&&
        strparent.find("this")==(string::npos)&&
        strparent.find("that")==(string::npos)){
    for(int i=0;i<str.length();i++){
      if(!isalpha(str[i]))continue;//" "
      //strparent[i]=(gap+str[i]-'a')%26+'a';
      strparent[i]=(gap+str[i])%26+'a';
    }
    gap++;
  }
  cout<<strparent<<endl;
}

int main(){
  string str;
  while(getline(cin,str)){
    Check(str);
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

string change(string s)
{
	string ss = "";
	for(int i = 0; i < s.length(); i++){
		if(isalpha(s[i])){
			if(s[i] >= 'a' && s[i] <= 'd')
				ss += 'z' - (s[i] - 'a');
			else
				ss += s[i] - 4;
		}
		else
			ss += s[i];
	}
	return ss;
}

int main(void)
{
	string s;

	while(getline(cin, s)){
		cout << change(s) << endl;
	}

	return 0;
}

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

using namespace std;

int main()
{
  string stro, str;
  while(getline(cin, stro)){
    for(int i = 0; i < 26; i++){
      str = stro;
      for(int j = 0; j < stro.length(); j++){
	if(str[j] != ' ' && str[j] != '.' && str[j] != '\n')
	  if(str[j] + i > 'z')
	    str[j] += i - 26;
	  else
	    str[j] += i;
      }
      unsigned f_the = str.find("the", 0);
      unsigned f_this = str.find("this", 0);
      unsigned f_that = str.find("that", 0);
      str.append("x");
      if((f_the != string::npos && f_the == 0 && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\n')) || (f_this != string::npos && f_this == 0 && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\n')) || (f_that != string::npos && f_that == 0 && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\n')))
	cout << str << endl;
      else if((f_the != string::npos && (str[f_the - 1] == ' ' || str[f_the - 1] == '.' || str[f_the - 1] == '\n') && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\n')) || (f_this != string::npos && (str[f_this - 1] == ' ' || str[f_this - 1] == '.' || str[f_this - 1] == '\n') && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\n')) || (f_that != string::npos && (str[f_that - 1] == ' ' || str[f_that - 1] == '.' || str[f_that - 1] == '\n') && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\n')))
	cout << str << endl;	 
    }
  }
}

C++: 	if('A'<= p && p <='Z'){
		p-='A';
		if(n<0) n+=26;
		p+=n;
		p%=26;
		p+='A';
		return p;
	}
	else if('a'<= p && p <='z'){
		p-='a';
		if(n<0) n+=26;
		p+=n;
		p%=26;
		p+='a';
		return p;
	}
	else return p;
}
/*
int checkch(char p){
	if('A'<= p && p <='Z') return 2;
	else if('a'<= p && p <='z') return 1;
	else return 0;
}
*/

int main(){

	int	i, j, n;
	char in[1000], *p, *tp;
	p= in;

	scanf("%[^\n]", in);
	for(n=0; 16<=in[n] && in[n]<=126; n++);
//		printf("%d\n", --n);

	while(1){
		tp=p;
		for(i=0; *(p++)!=' ';	i++);
		if(i==3||i==4){

			j=*tp-'t'; if(*(tp+1)=='h'+j) break;
			j=*tp-'T'; if(*(tp+1)=='h'+j){
			j+='a'-'A';
			break;
			}
		}
	}
	for(i=0; i<n; i++)	in[i]=shiftch(in[i],-j);

	printf("%s\n",in);

	return 0;
}

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


int main(void){
	string org;
	
	while(getline(cin,org)){

	for(int i=0; i<26; i++){
		for(int j=0; j<org.size(); j++){
			if( org[j] == '.' || org[j] == ' ' ) {}
			else {
				org[j]++;
				if( org[j] > 'z' )
					org[j] -= 26;
			}
		}
		string::size_type pos;
		pos = org.find("the");
		if( pos != string::npos ){
			cout << org << endl;
		}
		else{
			pos = org.find("this");
			if( pos != string::npos ){
				cout << org << endl;
			}
			else{
			pos = org.find("that");
			if( pos != string::npos ){
				cout << org << endl;
			}
			}
		}
	}
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
    int in;
    char S[1000];
    
    for(int i=0;;i++){
        
        in = getchar();
        
        if(in==EOF){
            S[i]='\0';
            break;
        }else{
            S[i]=(char)in;
        }
    }
    
    for(int k=0;;k++){
        
        bool f = false;
        
        for(int i=0;;i++){
            if('a'<=S[i] && S[i]<='y'){
                S[i]++;
            }else if(S[i]=='z'){
                S[i]='a';
            }
            
            if(i>=2){
                if(S[i-2]=='t' && S[i-1]=='h' && S[i]=='e')
                    f=true;
            }
            if(i>=3){
                if(S[i-3]=='t' && S[i-2]=='h')
                    if((S[i-1]=='i' && S[i-0]=='s') || (S[i-1]=='a' && S[i-0]=='t'))
                        f=true;
            }
            
            if(S[i]=='\0') break;
        }
        
        if(f) break;
    }
    
    for(int i=0;S[i]!='\0';i++)
        printf("%c",S[i]);
    
    return 0;
}