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>
using namespace std;
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>

void q17() {
	vector<string> hints;
	hints.push_back("the");
	hints.push_back("this");
	hints.push_back("that");

	vector< vector<string> > shiftHints;
	for (int i = 0; i < 26; i++) {
		vector<string> iShiftHints;
		for (int j = 0; j < hints.size(); j++) {
			string tmp = "";
			for (int k = 0; k < hints[j].length(); k++) {
				char z = ((hints[j][k] - 'a' + i) % 26) + 'a';
				tmp += ((hints[j][k] - 'a' + i) % 26) + 'a';
			}
			iShiftHints.push_back(tmp);
		}
		shiftHints.push_back(iShiftHints);
	}

	string str;
	for (; getline(cin, str);) {
		int s;
		bool flag = false;
		for (s = 0; s < 26; s++) {
			for (int i = 0; i < hints.size(); i++) {
				if (str.find(shiftHints[s][i]) != -1) {
					flag = true;
				}
			}
			if (flag) break;
		}

		string ans = "";
		for (int i = 0; i < str.length(); i++) {
			if ('a' <= str[i] && str[i]<= 'z') {
				ans += (str[i] - 'a' - s) % 26 + 'a';
			}
			else {
				ans += str[i];
			}
		}
		cout << ans << endl;
	}
}

int main() {
	q17();
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <sstream>

using namespace std;

bool is_comprehensible(const string& str){
	istringstream iss(str);
	string word;
	while(iss >> word){
		if(word == "the" || word == "this" || word == "that"){
			return true;
		}
	}
	return false;
}

string shift_string(const string& str, char n){
	string result;
	for(auto& v: str){
		if('a' <= v && v <= 'z'){
			result += (v - 'a' + n) % 26 + 'a';
		}
		else{
			result += v;
		}
	}
	return result;
}

int main(){
	string str;
	while(getline(cin, str)){
		for(int i = 0; i < 26; ++i){
			auto shifted = shift_string(str, i);
			if(is_comprehensible(shifted)){
				cout << shifted << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
signed main(){
    string s;
    while(getline(cin,s)){
        rep(i,26){
            bool flag=false;
            string t="";
            rep(j,s.size()){
                if(isalpha(s[j]))t=t+(char)('a'+(s[j]-'a'+i)%26);
                if(s[j]==' '){
                    if(t=="the"||t=="this"||t=="that"){
                        flag=true;
                        break;
                    }
                    t="";
                }
            }
            if(flag){
                rep(j,s.size()){
                    if(isalpha(s[j]))cout<<(char)('a'+(s[j]-'a'+i)%26);
                    else cout<<s[j];
                }
                cout<<endl;
                goto kaage;
            }
        }
        kaage:;
    }
    ggr;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  getline(cin,str);
  
  for(int i=0;i<str.size();i++){
    
    if(str[i] >= 'a' && str[i] <= 'z'){
      int a = (26+(str[i]-'a'-4))%26;
      str[i] = ('a'+a);
    }
    cout << str[i];
  }
  cout << endl;
  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 <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>

using namespace std;


int main(){
	string line;

	while(getline(cin, line)){
		int flag;
		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<line.size() ; j++){
				if(line[j] != ' ' && line[j] != '.'){
					if((line[j]-1) < 'a'){
						line[j] = line[j] -'a' + 'z' -1;
					}else{
						line[j]--;
					}
				}
			}

			for(int k=0 ; k<line.size() ; k++){
				if(line[k] == 't' && line[k+1] == 'h'){
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}

		cout << line << endl;
	}
	return 0;
}

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

int main() {
	string st;
	string w[3]={"the","this","that"};
	int wn[3]={3,4,4},k,i,j,s,f;
	while(getline(cin,st)) {
    cout << st.size() << endl;
    k=0;
	while(k<st.size()) {
		for (i=0;i<3;i++) {
			s=0; f=0;
			if (st.size()<k+wn[i]) break;
			for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
			if (s==wn[i]-1) { f=1; i=5; }
		}
		if (f==1) break;
		k++;
		}
	if (f==0) cout << st; else {
	for (i=0;i<st.size();i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
	}	
	cout << endl;
	}

C++: #include <stdio.h>
#include <string.h>
int main()
{
char str[81];
int i,j,l;
while(fgets(str,sizeof(str),stdin) != NULL){
l = strlen(str);
for(i = 0; i < 26; i++){
if(strstr(str,"the") != '\0' || strstr(str,"this") != '\0' || strstr(str, "that") != '\0')
break;
else{
for(j = 0; j < l; j++){
if(('a' <= str[j] && str[j] <= 'y') || ('A' <= str[j] && str[j] <= 'Y'))
str[j]++;
else if(str[j] == 'z')
str[j] = 'a';
else if(str[j] == 'Z')
str[j] = 'A';
}
}
}
printf("%s", str);
}
return 0;
}

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

int main(){
   string str;
   bool ans=false;
   getline(cin,str);
   
   string::iterator ite=str.begin();
   
   while(1){
      //cout << str.find("the");
      if(str.find("the")<str.size()) ans=true;
      else if(str.find("this")<str.size()) ans=true;
      else if(str.find("that")<str.size()) ans=true;
      if(ans) break;
      for(int i=0;i<str.size();i++){
         if(*(ite+i)>='A'&&*(ite+i)<='z') *(ite+i)-=1;
      }
   }
   cout << str << endl;
}