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 <cmath>
#include <sstream>
using namespace std;

string inc(string str, int c)
{
    for (int i = 0; i < str.size(); ++i) {
        if (str[i] < 'a' || 'z' < str[i])
            continue;
        int tmp = (str[i] - 'a' + c)%26;
        str[i] = 'a' + tmp;
    }
    return str;
}

int main(void)
{
    bool flag;
    string str;
    while (getline(cin, str)) {

    for (int i = 0; i < 26; ++i) {
        flag = false;
        string tmp;
        stringstream ss;
        ss << str;
        while (!ss.eof()) {
            ss >> tmp;
            tmp = inc(tmp, i);
            flag += tmp == "this";
            flag += tmp == "that";
            flag += tmp == "the";
            flag += tmp == "this.";
            flag += tmp == "that.";
            if (flag)
                break;
        }
        if (flag) {
            cout << inc(str, i) << endl;
            break;
        }
    }
    }
    return 0;
}

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

using namespace std;

string str;

bool caesar()
{
	bool flag = false;

	for (int i=0; i<(int)str.size() - 3; i++)
	{
		if(str[i] == 't' && str[i+1] == 'h') {
			if(str[i+2] == 'e') {
				flag = true;
				break;
			}
			if(str[i+2] == 'i' && str[i+3] == 's') {
				flag = true;
				break;
			}
			if(str[i+2] == 's' && str[i+3] == 't') {
				flag = true;
				break;
			}
		}
	}

	return flag;
}


int main()
{
	getline(cin, str);

	for (int i=0; i<25; i++)	//25文字ずれるまで繰り返す
	{
		if(caesar()) {
			cout << str << endl;
		}

		for (int j=0; str[j] != '\0'; j++) {
			if(str[j] != ' ' && str[j] != '.') {
				if(str[j] == 'z') {
					str[j] = 'a';
				}
				else {
					str[j]++;
				}
			}
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){ 
  char a[80];
  int i;
  while(cin>>a[i]){
    if(a[i]>='a'&&a[i]<='z')cout<<(char)(a[i]-4);
    else cout<<a[i];
    i++;
  }
  cout<<endl;
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	std::string str;
	std::string buf;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	while(std::getline(ifs, buf)){
#else
	while(std::getline(std::cin, buf)){
#endif
		str = buf;


		for(int i = 1; i <= 26; i++){
			for(int j = 0; j < str.size(); j++){
				unsigned char c = str[j];

				if(c >= 'a' && c <= 'z'){
					if(c == 'z'){
						c = 'a';
					}
					else{
						c++;
					}
				}
				str[j] = c;
			}

			std::istringstream stream(str);
			while(stream >> buf){
				if(buf == "the" || buf == "this" || buf == "that"){
					i = 27;
					break;
				}
			}
		}
		std::cout << str << std::endl;
	}
	return 0;
}

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

int main()
{
	string s;
	while(getline(cin, s)){
	
		while(s.find("the") == s.npos && s.find("this") == s.npos && s.find("that") == s.npos){
			for(size_t i=0;i<s.size();i++){
				if(s[i]>='a' && s[i]<='y'){
					s[i]++;
				}else if(s[i]=='z'){
					s[i] = 'a';
				}
			}
		}
		//whileを抜けたときにはtheかthisかthatが含まれている
		cout<<s<<endl;
	}
	return 0;
}

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

using namespace std;

void solve()
{
	string str;
	while(getline(cin, str))
	{
		int n = str.size();
		for(int i = 0; i < 26; ++i)
		{
			string Ans = str;
			for(int j = 0; j < n; ++j)
			{
				if('a' <= Ans[j] && Ans[j] <= 'z')
				{
					if(Ans[j] + i > 'z')
					{
						Ans[j] += i;
						Ans[j] -= 26;
					}
					else
					{
						Ans[j] += i;
					}
				}
			}
			for(int j = 0; j < n; ++j)
			{
				if(Ans[j] == 't')
				{
					if((j + 1 < n && Ans[j + 1] == 'h') && (j + 2 < n && Ans[j + 2] == 'i') && (j + 3 < n && Ans[j + 3] == 's'))
					{
						cout << Ans << endl;
						goto END;
					}
					else if(j + 1 < n && Ans[j + 1] == 'h' && j + 2 < n && Ans[j + 2] == 'a' && j + 3 < n && Ans[j + 3] == 't')
					{
						cout << Ans << endl;
						goto END;
					}
					else if(j + 1 < n && Ans[j + 1] == 'h' && j + 2 < n && Ans[j + 2] == 'e')
					{
						cout << Ans << endl;
						goto END;
					}
				}
			}
		}
	}
END:
	;
}

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

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

char buf[99];

int main(){
    int i;

    for(;~scanf("%[^\n] ",buf);){
        for(i=0; ; i++){
            if( buf[i]-buf[i+1] == 12 ){
                break;
            }
        }
        int sa = buf[i] - 't';
        for(i=0; buf[i]!='\0'; i++){
            buf[i]=!putchar( buf[i] - (97>buf[i] ? 0: sa) );
        }
        puts("");
    }
    return 0;
}

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

int main(){
	int i;
	string str;
	getline(cin, str);
	string strcp = str;
	string::iterator si;
	for(i=0;i<num;i++){
		if(  strcp.find("this", 0) != string::npos
		  || strcp.find("that", 0) != string::npos
		  || strcp.find("the", 0)  != string::npos){
			break;
		}
		si = strcp.begin();
		while(si != strcp.end()){
			if('a' <= *si && *si <= 'y'){
				*si = *si + char(1);
			}else if(*si == 'z'){
				*si = 'a';
			}
			si++;
		}
	}
	cout << strcp << endl;
	return 0;
}

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

int main(){
    char a[81];
    int size;
    int i,t;
    fgets(a,81,stdin);
    size = strlen(a);
    for(t=0;t<26;t++){
        for(i=0;i<size;i++)if(isalpha(a[i]))a[i] = 'a'+(a[i]+1-'a')%26;
        for(i=0;i<size;i++){
            if(a[i]=='t'&&a[i+1]=='h'){
                if(a[i+2]=='e'||(a[i+2]=='i'&&a[i+3]=='s')||(a[i+2]=='a'&&a[i+3]=='t')){
                    printf("%s",a);
                    return 0;
                }
            }
        }
    }
}

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

using namespace std;

int dist(int a, int b) {
	int d = b-a;
	if (d >= 26)
		return d-26;
	if (d < 0)
		return d+26;
	return d;
}

int main() {
	char s[81];
	while (cin.getline(s, 81)) {
		int len = strlen(s);
		int shift;
		for (int i = 0; i <= len-4; i++) {
			if (dist(s[i],s[i+1]) != dist('t','h'))
				continue;
			if (
					(dist(s[i+1], s[i+2]) == dist('h','a') && dist(s[i+2],s[i+3]) == dist('a','t')) ||
					(dist(s[i+1], s[i+2]) == dist('h','i') && dist(s[i+2],s[i+3]) == dist('i','s')) ||
					dist(s[i+1], s[i+2]) == dist('h','e'))
				shift = dist(s[i],'t');
		}
		if (
				dist(s[len-3],s[len-2]) == dist('t','h') &&
				dist(s[len-2],s[len-1]) == dist('h','e'))
			shift = dist(s[len-3], 't');
		for (int i = 0; i < len; i++) {
			if (isalpha(s[i]))
				s[i] = (s[i]-'a'+shift)%26+'a';
		}
		cout << s << endl;
	}
	return 0;
}