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<iostream>
#include<string.h>
#include<stdio.h>

int main(){

	char s[100];
	while (gets(s)){
		
		int diff;
		int flag = false;
		//一番最初に｛the,that,this｝がある場合
		diff = s[0] - 't';
		if ((s[1] - diff) == 'h'){
			//printf("%c\n", s[j+1] - diff);
			if ((s[2] - diff) == 'e'){
				//printf("%c\n", s[j + 2] - diff);
				if (s[3] == ' '){
					flag = true;
				}
			}
			else if ((s[2] - diff) == 'a'){
				//printf("%c\n", s[j + 2] - diff);
				if ((s[3] - diff) == 't'){
					//printf("%c\n", s[j + 3] - diff);
					if (s[4] == ' '){
						flag = true;
					}
				}
			}
			else if ((s[2] - diff) == 'i'){
				//printf("%c\n", s[j + 2] - diff);
				if ((s[3] - diff) == 's'){
					//printf("%c\n", s[j + 3] - diff);
					if (s[4] == ' '){
						flag = true;
					}
				}
			}
		}

		if (!flag){
			//一番以降に｛the,that,this｝がある場合
			for (int j = 1; j < strlen(s); j++){
				if ((s[j]) == ' '){
					diff = s[j + 1] - 't';
					if ((s[j + 1] - diff) == 't'){
						//printf("diff:%d\n", diff);
						if ((s[j + 2] - diff) == 'h'){
							//printf("%c\n", s[j+1] - diff);
							if ((s[j + 3] - diff) == 'e'){
								//printf("%c\n", s[j + 2] - diff);
								if (s[j + 4] == ' '){
									break;
								}
							}
							else if ((s[j + 3] - diff) == 'a'){
								//printf("%c\n", s[j + 2] - diff);
								if ((s[j + 4] - diff) == 't'){
									//printf("%c\n", s[j + 3] - diff);
									if (s[j + 5] == ' '){
										break;
									}
								}
							}
							else if ((s[j + 3] - diff) == 'i'){
								//printf("%c\n", s[j + 2] - diff);
								if ((s[j + 4] - diff) == 's'){
									//printf("%c\n", s[j + 3] - diff);
									if (s[j + 5] == ' '){
										break;
									}
								}
							}

						}
					}
				}
			}
		}
		//printf("diff:%d\n",diff);
		for (int i = 0; i < strlen(s); i++){
			if (s[i] == ' ' || s[i] == '.')continue;
			s[i] -= diff;
		}
		//s[strlen(s) - 1] = '\n';
		printf("%s\n", s);
	}
	return 0;

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

using namespace std;

int main()
{
    vector<string> str;
    string input;
    int num[81];
    int slide = 0;
    const int al_num = 26;
    string s_the[al_num];
    string s_this[al_num];
    string s_that[al_num];    

    for (int i = 0; i < al_num; i++) {
        s_the[i].push_back(('t' + i - 'a') % al_num + 'a');
        s_the[i].push_back(('h' + i - 'a') % al_num + 'a');
        s_the[i].push_back(('e' + i - 'a') % al_num + 'a');
    }
    cout << endl;
    for (int i = 0; i < al_num; i++) {
        s_this[i].push_back(('t' + i - 'a') % al_num + 'a');
        s_this[i].push_back(('h' + i - 'a') % al_num + 'a');
        s_this[i].push_back(('i' + i - 'a') % al_num + 'a');
        s_this[i].push_back(('s' + i - 'a') % al_num + 'a');
    }
    for (int i = 0; i < al_num; i++) {
        s_that[i].push_back(('t' + i - 'a') % al_num + 'a');
        s_that[i].push_back(('h' + i - 'a') % al_num + 'a');
        s_that[i].push_back(('a' + i - 'a') % al_num + 'a');
        s_that[i].push_back(('t' + i - 'a') % al_num + 'a');
    }

    for (int i = 0; i < al_num; i++)
        num[i] = -1;

    int i = 0;
    while (cin >> input) {
        num[i++] = input.size();
        str.push_back(input);
    }
    str[i - 1].erase(str[i - 1].size() - 1);
    num[i - 1]--;

    bool loop = false;
    for (int i = 0; num[i] != -1; i++) {
         if (num[i] == 3) { // "the"
             for (int j = 0; j < al_num; j++) {
                if (str[i] == s_the[j]) {
                    slide = j;
                    loop = true;
                    break;
                }
            }
        }
        else if (num[i] == 4) { // "this", "that"
            for (int j = 0; j < al_num; j++) {
                if (str[i] == s_this[j] || str[i] == s_that[j]) {
                    slide = j;
                    loop = true;
                    break;
                }
            }
        }
        
        if (loop)
            break;
    }
    
    // output
    for (int i = 0; num[i] != -1; i++) {
        for (int j = 0; j < num[i]; j++) {
            char c;
            if (str[i][j] - slide < 'a')
                c = 'z' - ('a' - 1 - (str[i][j] - slide));
            else
                c = (str[i][j] - slide - 'a') % al_num + 'a';
            cout << c;
        }
        cout << ' ';
    }
    cout << '\b' << '.' << endl;

    return 0;
}

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

vs split(const string &text, char delim=' '){
	int p1 = 0, p2 = 0;
	vs tokens;

	for (int i=0; i<(int)text.size(); i++)
		if (text[i] == delim){
			p2 = i;
			tokens.push_back(text.substr(p1, p2 - p1));
			p1 = p2 + 1;
		}
	tokens.push_back(text.substr(p1));
	return tokens;
}

int rot(string &text){
	for (int i=0; i<(int)text.size(); i++){
		char c=text[i];
		if (islower(c))
			if (c=='z') text[i]='a';
			else text[i]++;
	}
	return 0;
}

bool check(string text){
	vs words = split(text);
	for (int i=0; i<(int)words.size(); i++){
		string s = words[i];
		if (s=="the" || s=="this" || s=="that")
			return true;
	}
	return false;
}

int main(void){
	string s;
	while (true){
		getline(cin, s);
		if (cin.eof()) break;
		for (int i=0; i<26; i++)
			if (check(s)) break;
			else rot(s);
		cout<<s<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  string str;
  while (getline(cin, str)) {
    for (int i = 0; i < 26; ++i) {
      for (char& c : str) {
        if (isalpha(c)) {
          if (c != 'z') ++c;
          else c = 'a';
        }
      }
      if (str.find("that") != string::npos || str.find("this") != string::npos || str.find("the") != string::npos) {
        cout << str << endl;
      }
    }
  }
}

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], w[5], *p, *tp;
	p= in;

	scanf("%[^\n]", in);
	n= strlen(in);
//	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;
			}
		}
//		++p;
	}
	for(i=0; i<n; i++)	in[i]=shiftch(in[i],-j);

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

	
	
	return 0;
}