Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		var result string
		line := scanner.Text()
		key := make(map[string]string)

		var i int32
		for ; i < 52; i++ {
			makeKey(key, i)
			result = decode(key, line)

			if strings.Contains(result, "the") {
				break
			} else if strings.Contains(result, "this") {
				break
			} else if strings.Contains(result, "that") {
				break
			}
		}

		fmt.Println(result)
	}
}

func makeKey(key map[string]string, shift int32) {
	for i := 'a'; i <= 'z'; i++ {
		cipher := (i + shift)
		if cipher > 'z' {
			cipher = cipher%'z' + 'a' - 1
		} else if cipher < 'a' {
			cipher = cipher + ('z' - 'a') + 1
		}
		key[string(i)] = string(cipher)
	}
}

func decode(key map[string]string, cipher string) string {
	var result string
	for _, v := range cipher {
		if key[string(v)] != "" {
			result += key[string(v)]
		} else {
			result += string(v)
		}
	}
	return result
}

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

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

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

using namespace std;

int main(int argc, char **argv)
{
	char a[82], t;
	int n, p;
	
	while(cin.getline(a, 81, '\n')){
		n = strlen(a);
		for(int i = 0; i < n; i++){
			p = (int)(a[i++]-'t');
			if(a[i] == ' '){
				continue;
			}
			t = a[i++]-p;
			if(t < 'a'){
				t += 25;
			} else if(t > 'z'){
				t -= 25;
			}
			if(a[i] == ' '){
				continue;
			}
			if(t == 'h'){
				t = a[i++]-p;
				if(t < 'a'){
					t += 25;
				} else if(t > 'z'){
					t -= 25;
				}
				if(t == 'e' && a[i] == ' '){
					break;
				} else if(t == 'i'){
					t = a[i++]-p;
					if(t < 'a'){
						t += 25;
					} else if(t > 'z'){
						t -= 25;
					}
					if(t == 's' && a[i] == ' '){
						break;
					}
				} else if(t == 'a'){
					t = a[i++]-p;
					if(t < 'a'){
						t += 25;
					} else if(t > 'z'){
						t -= 25;
					}
					if(t == 't' && a[i] == ' '){
						break;
					}
				}
			}
		}
		
		for(int i = 0; i < n; i++){
			if(a[i] == ' ' || a[i] == '.' || a[i] == ','){
				printf("%c",a[i]);
			} else {
				t = a[i]-p;
				if(t < 'a'){
					t += 25;
				} else if(t > 'z'){
					t -= 25;
				}
				printf("%c",t);
			}
		}
		cout << endl;
	}
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	string s;
	while(getline(cin, s)) {
		while (s.find("the") == string::npos && s.find("this") == string::npos && s.find("that") == string::npos) {
			for (int i = 0; i < s.length(); ++i) {
				if ('a' <= s[i] && s[i] <= 'z') {
					int c;
					c = (s[i] - 'a' + 1) % ('z' - 'a' + 1);
					s[i] = c + 'a';
				}
			}
		}
		cout << s << endl;
	}
	return 0;
}

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

bool isSmallAlphabet(char& ch) {
  /* a ~ z(ascii) : 97 ~ 122 */
  if('a' <= ch && ch <= 'z') return true;
  else return false;
}

bool isHit(string& str) {
  if(str.find("the") != str.npos) return true;
  else if(str.find("this") != str.npos) return true;
  else if(str.find("that") != str.npos) return true;
  else return false;
}

char shiftIndex(char ch) {
  if(isSmallAlphabet(ch)) {
    ch += 1;
    /* ???????????????????°?????????§???????????£??????*/
    if(!isSmallAlphabet(ch)) {
      ch -= 26;
    }
  }
  return ch;
}

/* ????????¶??????????§£??? */
void CaesarCipher(string str) {
  
  /* p??????????????¢??????????????????????????????????????? */
  for(int p = 0; p < 26; ++p) {

    transform(str.begin(), str.end(), str.begin(), shiftIndex);

    /* Find "the" or "this" or "that" */
    if(isHit(str)) {
      cout << str << endl;
    }
  }
}

int main() {
  string str;
  while(getline(cin, str)) {
    CaesarCipher(str);
  }
  return 0;
}

C++: #include<cstdio>
#include<cctype>
#include<cstring>
using namespace std;
int main(){
    int f = 0;
    char str[10000] = {0};
    while(scanf("%[^\n]",str)!=EOF){
        fflush(stdin);
        for(int i = 0;i <= 25; i++){
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == ' ' || str[j] == '.')continue;
                str[j]++;
                if(str[j] > 122)str[j] = str[j]-25;
            }
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'e')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'i' && str[j+3] == 's')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'a' && str[j+3] == 't')goto hoge;
            }
        }
        for(int i = 0;i < strlen(str); i++){
            if(str[i] == ' ' || str[i] == '.')continue;
            str[i] -= 25;
        }
        for(int i = 0;i <= 25; i++){
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == ' ' || str[j] == '.')continue;
                str[j]--;
                if(str[j] < 97)str[j] = str[j]+25;
            }
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'e')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'i' && str[j+3] == 's')goto hoge;
                if(str[j] == 't' && str[j+1] == 'h' && str[j+2] == 'a' && str[j+3] == 't')goto hoge;
            }
        }
        hoge:
        printf("%s\n",str);
        memset(str,0,sizeof(str));
    }
    return 0;
}