Go: package main

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

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 len(infos) == 0 {
			break
		}
		// 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>
using namespace std;
int main(){
	string str;int n=0; bool flag=false;
	getline(cin,str);
	for(int k=0;k<26;k++){
		for(int i=0;i<str.size();i++){
				if(str[i]-'a'<0 || str[i]-'z'>0) continue;
				else if(++str[i]-'z'>0) str[i]-=26;		
		};
		string ptr; string qtr;
		for(int i=0;i<str.size()-4;i++){
		ptr=str.substr(i,4); qtr=str.substr(i,3);
			if(ptr=="this" || ptr=="that" || qtr=="the") flag=true;
			if(flag==true) break;
		};
		if(flag==true) break;
	};
	cout << str << '\n' ;
}

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

string arrs[200];

bool judge4(const string &str) {
	int d1 = str[0] - 't';
	int d2 = str[1] - 'h';
	int d3 = str[2] - 'i';
	int d4 = str[3] - 's';
	int d5 = str[2] - 'a';
	int d6 = str[3] - 't';
	return (d1 == d2 && ((d2 == d3 && d3 == d4) || (d2 == d5 && d3 == d6)));
}

bool judge3(const string &str) {
	int d1 = str[0] - 't';
	int d2 = str[1] - 'h';
	int d3 = str[2] - 'e';
	return (d1 == d2 && d2 == d3);
}

int main() {
	cin.clear();
	int cnt = 0;
	while (!cin.eof()) {
		cin >> arrs[cnt++];
		if (cin.eof()) break;
		char ch = getchar();
		if (ch == '\n') {
			bool isOk = 0;
			int delta = 0;
			for (int i = 0; i < cnt; ++i) {
				if (arrs[i].length() == 4) {
					if (judge4(arrs[i])) {
						isOk = 1;
						delta = arrs[i][0] - 't';
						break;
					}
				}else if (arrs[i].length() == 3) {
					if (judge3(arrs[i])) {
						isOk = 1;
						delta = arrs[i][0] - 't';
						break;
					}
				}
			}
			for (int i = 0; i < cnt; ++i) {
				for (int j = 0; j < arrs[i].length(); ++j) 
					if (arrs[i][j] != '.') arrs[i][j]-= delta;
				cout << arrs[i] << ((i == cnt - 1) ? "\n" : " ");
			}
			cnt = 0;
		}
	}
	return 0;
}

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

int main(){
  int index ,flag=0 ,temp= 'z' - '`' ,cnt=0;
  string s ,key[3]={ "the" ,"this" ,"that" };

  while( true ){
    flag = 0;
    getline( cin ,s );
    if( cin.eof() ){
      break;
    }

    while( true ){
      for( int i=0 ; i<s.length()+1 ; i++ ){ // シーザー暗号を戻す
	if( s[i] != '.' && s[i] != ' ' && s[i] != '\n' ){ //　記号はスルー
	  s[i]++;
	  if( s[i] > 'z' ){ // zからaに飛ばす
	    s[i] = 'a';
	  }
	}
      }

      for( int i=0 ; i<3 ; i++ ){
	index = s.find( key[i] ,0 ); // the ,this ,that を探す
	if( index != string::npos ){ // あった
	  cout << s << endl;
	  flag = 1;
	  break;
	}
      }

      if( flag == 1 ){
	break;
      }
    }
  }
}

C++: #include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
	int f = 0,i;
	for(;;){
		char word[100]={0};
		for(i=0;;i++){
			if(scanf("%c",&word[i]) == EOF){f = 1;word[i]=10; break;}
			if(word[i] == 10){break;}
		}
		for(int l=0;l<26;l++){
			for(i=0;i<(int)strlen(word);i++){
				if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'i' && word[i+3] == 's' && word[i+4] == ' '){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'a' && word[i+3] == 't' && word[i+4] == ' '){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'e' && word[i+3] == ' '){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'i' && word[i+3] == 's' && word[i+4] == '\n'){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'a' && word[i+3] == 't' && word[i+4] == '\n'){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'e' && word[i+3] == '\n'){break;}
			}
			if(i != (int)strlen(word)){cout<<word;break;}
			for(i=0;i<(int)strlen(word);i++){
				if(word[i]==122){word[i]=97;}
				else if(word[i]>=97 && word[i]<122){word[i]++;}
			}
		}
		if(f == 1){break;}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
    string s;
    while(getline(cin, s)){
        for(int i=0;i<26;++i){
            string ans;
            for(int j=0;j<s.size();++j){
                if(s[j] >= 'a' && s[j] <= 'z'){
                    char c = (s[j] - 'a' + i) % 26 + 'a';
                    ans.push_back(c);
                }else{
                    ans.push_back(s[j]);
                }
            }
            if(ans.find("the") != -1 || ans.find("this") != -1 || ans.find("that") != -1){
                cout << ans << endl;
                break;
            }
        }
    }

    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <stdio.h>

using namespace std;

int pat[3][3];
int len[3];
int chr[3];
int zure;
int size;
bool atteru[3];
char text[100];

int main() {
	//cin >> text;
	gets(text);
	//int size = text.size();
	int pt = 0;
	while (text[pt] != EOF) {
		pt++;
		size++;
	}

	pat[0][0] = 't' - 'h';
	pat[0][1] = 'h' - 'e';
	pat[1][0] = 't' - 'h';
	pat[1][1] = 'h' - 'i';
	pat[1][2] = 'i' - 's';
	pat[2][0] = 't' - 'h';
	pat[2][1] = 'h' - 'a';
	pat[2][2] = 'a' - 't';
	chr[0] = 'e';
	chr[1] = 's';
	chr[2] = 't';
	len[0] = 3;
	len[1] = 4;
	len[2] = 4;

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			if (pat[i][j] < 0) pat[i][j] += 26;
		}
	}

	zure = -1;

	int cnt = 0;
	atteru[0] = true;
	atteru[1] = true;
	atteru[2] = true;
	for (int i = 0; i < size-1 && zure == -1; i++) {
		if (text[i+1] == ' ' || cnt > 3) continue;
		if (text[i] == ' ') {
			cnt = 0;
			atteru[0] = true;
			atteru[1] = true;
			atteru[2] = true;
			//cout << "yarinaoshi!" << endl;
			continue;
		}
		int dist = text[i] - text[i+1];
		if (dist < 0) dist += 26;
		for (int j = 0; j <= 2; j++) {
			if (!atteru[j]) continue;
			if (cnt >= len[j]-1) continue;
			if (dist != pat[j][cnt]) {
				atteru[j] = false;
				//cout << j << " ha tigau!" << endl;
				continue;
			} else if (cnt == len[j]-2) {
				//cout << j << " ha atteta!" << endl;
				zure = text[i+1] - chr[j];
				if (zure < 0) zure += 26;
				//cout << "zure = " << zure << endl;
			}
		}
		cnt++;
	}

	for (int i = 0; i < size; i++) {
		if (text[i] == '.') break;
		if (text[i] == ' ') continue;
		text[i] = text[i] - zure;
		if (text[i] < 'a') text[i] += 26;
	}

	cout << text << endl;

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/