Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func incrementByte(b byte) byte {
	if b >= 97 && b < 122 {
		return b + 1
	} else if b == 122 {
		return 97
	}
	return b
}

func main() {
	scanner.Split(bufio.ScanLines)

	for {
		line := nextString()
		if len(line) == 0 {
			break
		}
		for i := 0; i <= 26; i++ {
			decoded := []byte{}
			for j := 0; j < len(line); j++ {
				decoded = append(decoded, incrementByte(line[j]))
			}
			line = string(decoded)
			if strings.Contains(line, "the") || strings.Contains(line, "this") || strings.Contains(line, "that") {
				fmt.Println(line)
				break
			}
		}
	}
}

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

int main() {
  string bstr;

  while (getline(cin, bstr)) {
    int n = 26; 
    while (n--) {
      if (bstr.find("this", 0) != string::npos) {
        break;
      } else if (bstr.find("that", 0) != string::npos) {
        break;
      } else if (bstr.find("the", 0) != string::npos) {
        break;
      }   
      for (int i = 0; i < bstr.size(); i++) {
        if (bstr[i] >= 'a' && bstr[i] <= 'z') {
          if (bstr[i] != 'z')
            bstr[i]++;
          else
            bstr[i] = 'a';
        }
      }   
    }   
    cout << bstr << 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(gets(a)!=NULL){
		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++: #include <stdio.h>
#include <math.h>

using namespace std;

int main(){

	char buf[81],result[81];
	bool FLG;

	while(fgets(buf,81,stdin)!=0){
		FLG = false;
		for(int i=0;i<=25;i++){ //?????????????????°
			for(int k=0;buf[k]!='\0';k++){
				if(buf[k] >= 97 && buf[k] <= 122){
					if(buf[k]+i<=122){
						result[k]=buf[k]+i;
					}else{
						result[k]=97+(buf[k]+i-123);
					}
				}else{
					result[k]=buf[k];
				}
				result[k+1]='\0';
			}
			for(int k=0;result[k]!='\0';k++){
				// the this that ????????????????????????????????????
				for(int p=4;result[p]!='\0';p++){
					if(result[p]==' ' && result[p-1] == 'e' && result[p-2] == 'h' && result[p-3] == 't' && result[p-4] == ' '){
						FLG = true;
						break;
					}
				}
				if(FLG)break;
				for(int p=5;result[p]!='\0';p++){
					if(result[p]==' ' && result[p-1] == 's' && result[p-2] == 'i' && result[p-3] == 'h' && result[p-4] == 't' && result[p-5] == ' '){
						FLG = true;
						break;
					}
				}
				if(FLG)break;
				for(int p=5;result[p]!='\0';p++){
					if(result[p]==' ' && result[p-1] == 't' && result[p-2] == 'a' && result[p-3] == 'h' && result[p-4] == 't' && result[p-5] == ' '){
						FLG = true;
						break;
					}
				}
				if(FLG)break;
			}
			if(FLG)break;
		}
		printf("%s\n",result);

	}

    return 0;
}

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

int main(int argc, const char * argv[])
{
    string word;
    while (getline(cin, word)) {
        string word_tmp = word;
        int cnt, real;
        real = cnt = 0;
        
        //正の場合
        for (int i = 0; i < 26; i++) {
            for (int j = 0; j < word_tmp.size(); j++) {
                word_tmp[j]++;
            }
            cnt++;
            for (int j = 0; j < word_tmp.size(); j++) {
                string word3 = word_tmp.substr(j, 3);
                string word4 = word_tmp.substr(j, 4);
                if (word3 == "the") {
                    real = cnt;
                }
                if (word4 == "this" || word4 == "that") {
                    real = cnt;
                }
            }
        }
        
        //負の場合
        cnt = 0;
        word_tmp = word;
        if (real == 0) {
            for (int i = 0; i < 26; i++) {
                for (int j = 0; j < word_tmp.size(); j++) {
                    word_tmp[j]--;
                }
                cnt--;
                for (int j = 0; j < word_tmp.size(); j++) {
                    string word3 = word_tmp.substr(j, 3);
                    string word4 = word_tmp.substr(j, 4);
//                    cout << word4 << endl;
                    if (word3 == "the") {
                        real = cnt;
                    }
                    if (word4 == "this" || word4 == "that") {
//                        cout << word_tmp << endl;
                        real = cnt;
                    }
                }
            }
        }
        for (int i = 0; i < word.size(); i++) {
            if (word[i] != ' ') {
                if (word[i] != '.') {
                    word[i] += real;
                }
            }
        }
        cout << word << endl;
    }
    return 0;
}

C++: //#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
#include <sstream>

using namespace std;


int main(){

	string s,sc, buf;
	stringstream ss;
	vector <string> as;
	int dif = 0;


	while (getline(cin, s)){
		dif = 0;
		buf = "";
		sc = "";
		ss.str("");
		ss.clear();

		sc += s;
		for (int i = 0; i < sc.size(); i++){
			if (sc[i] == '.')sc[i] = ' ';
		}
		ss << sc;

		while (ss >> buf){
			//the this that???????´¢
			if (buf.size() == 3){
				if ((buf[0] - buf[1]) == 12 && (buf[0] - buf[2]) == 15){
					dif = buf[0] - 't';
					break;
				}
			}
			else if (buf.size() == 4){
				if ((buf[0] - buf[1]) == 12 && (buf[0] - buf[2]) == 11 && (buf[0] - buf[3]) == 1){
					dif = buf[0] - 't';
					break;
				}
				if ((buf[0] - buf[1]) == 12 && (buf[0] - buf[2]) == 19 && (buf[0] - buf[3]) == 0){
					dif = buf[0] - 't';
					break;
				}
			}
		}

		for (int i = 0; i < s.size(); i++){
			if (s[i] >= 'a' && s[i] <= 'z') {
				s[i] -= dif;
				if (s[i] < 'a') s[i] += 26;
				if (s[i] > 'z') s[i] -= 26;
			}
		}

		cout << s << endl;
	}




	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
string S; char T[29] = "abcdefghijklmnopqrstuvwxyz. "; int x[100000];
int main() {
	getline(cin, S);
	for (int i = 0; i < 100000; i++) { x[i] = 100000; }
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j < 28; j++) {
			if (T[j] == S[i]) {
				x[i] = j;
			}
		}
	}
	for (int h = 0; h < 26; h++) {
		for (int i = 0; i < S.size(); i++) {
			if (x[i] == 19 && x[i + 1] == 7 && x[i + 2] == 8 && x[i + 3] == 18) {
				goto E;
			}
			if (x[i] == 19 && x[i + 1] == 7 && x[i + 2] == 0 && x[i + 3] == 18) {
				goto E;
			}
			if (x[i] == 19 && x[i + 1] == 7 && x[i + 2] == 4) {
				goto E;
			}
		}
		for (int i = 0; i < S.size(); i++) {
			if (x[i] < 26) {
				x[i]++;
				x[i] %= 26;
			}
		}
	}
E:;
	for (int i = 0; i < S.size(); i++) {
		cout << T[x[i]];
	}
	cout << endl;
}