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;

int main(){
  string s;
  while(1){
    getline(cin,s);
    if(cin.eof()) break;
    for(int i=0;i<25;i++){
      for(int j=0;j<=s.size();j++){
	if(s[j] >= 'a' && s[j] <= 'y') s[j]++;
	else if(s[j] == 'z') s[j]='a';
      }
      if((s.find("this ")!=string::npos) || (s.find("that ")!=string::npos) || (s.find("the ")!=string::npos)) break;
    }
    cout << s << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int main(){
	char input[100],str[50][100];
	const char cmp[3][5]={"that","this","the"};
	int pos=0,last_pos=0,i,j,k,diff,n;
	bool flag;

		fgets(input,100,stdin);
		for(i=0;input[i]!='\0';i++){
			if(input[i]==' ' || input[i]=='.' || input[i]=='\n'){
				for(j=last_pos;j<i;j++){
					str[pos][j-last_pos]=input[j];
				}
				str[pos][j-last_pos]='\0';
				pos++;
				last_pos=i+1;
			}
		}

		n=0;
		flag=false;
		while(++n){
			for(i=0;i<pos;i++){
				for(j=0;str[i][j]!='\0';j++){
					str[i][j]+=1;
					if('a'>str[i][j]){
						str[i][j]+='z'-'a'+1;
					}else if('z'<str[i][j]){
						str[i][j]+='a'-'z'-1;
					}
				}
			}

			for(i=0;i<pos;i++){
				for(j=0;j<3;j++){
					if(strcmp(str[i],cmp[j])==0){
						flag=true;
                        j=3;i=pos;
					}
				}
			}
			if(flag) break;
		}

		int temp;
		for(i=0;input[i]!='\0';i++){
			if(input[i]!='.' && input[i]!=' ' && input[i]!='\n'){
				temp=input[i]+n;
				if('a'>temp){
					input[i]=temp+'z'-'a'+1;
				}else if('z'<temp){
					input[i]=temp+'a'-'z'-1;
				}else{
					input[i]=temp;
				}
			}
		}
		printf("%s",input);

	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <string.h>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define REP(i,e) for (int i = 0; i != int(e); i++)
#define FORIT(i, A) for (auto i : A)
#define ISEQ(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << endl
#define SZ(x) ((int)(x).size())

#define DIST(a, b) (((a) - (b) + 26)%26)

int dht = DIST('h', 't');
int deh = DIST('e', 'h');
int dah = DIST('a', 'h');
int dta = DIST('t', 'a');
int dih = DIST('i', 'h');
int dsi = DIST('s', 'i');

int check(const char* word)
{
	if (DIST(word[1], word[0]) != dht)
		return -1;

	if (DIST(word[2], word[1]) == deh && 
		(word[3] == ' ' || word[3] == '\0' || word[3] == '.'))
	{
		return DIST(word[0], 't');
	}
	if (DIST(word[2], word[1]) == dah && 
		DIST(word[3], word[2]) == dta &&
		(word[4] == ' ' || word[4] == '\0' || word[4] == '.'))
	{
		return DIST(word[0], 't');
	}
	if (DIST(word[2], word[1]) == dih && 
		DIST(word[3], word[2]) == dsi && 
		(word[4] == ' ' || word[4] == '\0' || word[4] == '.'))
	{
		return DIST(word[0], 't');
	}
	return -1;
}

int main(int argc, char const *argv[])
{
	string s;
	while (getline(std::cin, s))
	{
		int len = s.length();
		int d = check(&s[0]);
		int i = 3;
		while (d == -1)
		{
			while(i < len && s[i] != ' ')
				i++;
			if (i == len) break;
			i++;
			d = check(&s[i]);
		}
		REP(j, len)
		{
			if (s[j] >= 'a' && s[j] <= 'z')
			{
				s[j] = (s[j] - 'a' - d + 26) % 26 + 'a';
			}
		}
		std::cout << s << std::endl;
	}
	return 0;
}

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

string tar[] = { "the", "this", "that" };

int main()
{
	string in;
	while (getline(cin, in))
	{
		string ans;
		for (int i=0; i<26; i++)
		{
			ans = in;
			for (int k=0; k<ans.size(); k++)
			{
				if (islower(ans[k]))
				{
					int r = i - ('z' - ans[k]);
					if (r > 0)
						ans[k] = (char) ((int) 'a' + r);
				}
			}

			if (	   ans.find(tar[0], 0) != string::npos
				|| ans.find(tar[1], 0) != string::npos
				|| ans.find(tar[2], 0) != string::npos)
				break;
		}

		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	string str[80];int n=0; bool flag=false;
	while(cin >> str[n++]) ;
	for(int k=0;k<26;k++){
		for(int i=0;i<n;i++) {
			for(int j=0;j<str[i].size();j++){
				if(str[i][j]-'a'<0 || str[i][j]-'z'>0) ;
				else if(++str[i][j]-'z'>0) str[i][j]-=26;		
			};
		};
		for(int i=0;i<n;i++){
			if(str[i]=="this" || str[i]=="that" || str[i]=="the") flag=true;
			if(flag==true) break;
		};
		if(flag==true) break;
	};
	for(int i=0;i<n;i++){ if(i) cout << ' ' ; cout << str[i] ;};
	cout << '\n' ;
}

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

using namespace std;

constexpr unsigned ALPH_NUM = 26;

string shift(const string& line, int n);
bool judge(string& word);

int main()
{
    string line;
    bool is_solved = false;
    while(getline(cin, line)) {
        for (unsigned i = 0; i < ALPH_NUM && !is_solved; i++) {
            string shifted = shift(line, i);

            stringstream ss(shifted);
            string word;
            while (ss >> word) {
                if (judge(word)) {
                    cout << shifted << endl;
                    is_solved = true;
                    break;
                }
            }
        }
    }

    return 0;
}

string shift(const string& line, int n)
{
    string shifted = line;

    for (unsigned i = 0; i < line.size(); i++) {
        if (line.at(i) >= 'a' && line.at(i) <= 'z') {
            shifted.at(i) = static_cast<char>('a' + (line.at(i) - 'a' + n) % ('z' - 'a' + 1));
        } else {
            shifted.at(i) = line.at(i);
        }
    }

    return shifted;
}

bool judge(string& word)
{
    if (word.at(word.size() - 1) == '.') {
        word.erase(word.end() - 1);
    }

    return ((word == "the" || word == "this" || word == "that")? true: false);
}

C++: #include<stdio.h>
#include<string.h>

char p[1024];
char y[1024];

int main(void){
	while(gets(p)){
		int x = strlen(p);
		int f = 0;
		for(int i = 0; i < 26; i++){
			for(int j = 0; j < x; j++)if(p[j] >= 'a' && p[j] <='z')p[j] = (p[j]+1-'a')%26 + 'a';
			
			if(strstr(p,"the")!= NULL)break;
			if(strstr(p,"that")!= NULL)break;
			if(strstr(p,"this")!= NULL)break;
		}
		puts(p);
	}
	
	return 0;
}