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 <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;
}

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

using namespace std;

char data[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char trans[100];
char mozi;
int position=0;
int zoom;
int first_check=0,first_position=0;
int now;
char result;

int main(){
	while(scanf("%c",&mozi) != EOF){

		if(first_check == 0)

		for(int i=0;i<26 && first_check == 0;i++){
			if(mozi == data[i]){
				first_position = i;
				zoom = first_position - 19;
				first_check = 1;
			}
		}




		if(mozi == ' ' || mozi == '.' || mozi == '\n'){
			if(mozi == ' ' || mozi == '.'){
				trans[position] = mozi;
				position++;
			}

			if(mozi == '\n'){
				trans[position] = '\n';
				printf("%s",trans);
				first_check = 0;
				position = 0;
				memset(trans,'\0',sizeof(trans));
			}
		}else{
			for(int i=0;i<26;i++){
				if(data[i] == mozi){
					now = i;
					break;
				}
			}

			trans[position] = data[now - zoom];
			position++;

		}
	}
}

C++: #include<cstdio>
//#include<iostream>
#include<cstring>

using namespace std;



char shiftch(char p, int n){
	int t;
	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);
	n= strlen(in);

	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;
}