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;

bool isPlain(string secret){
    bool find_the,find_that,find_this;
    
    find_the = (secret.find("the") != string::npos);
    find_that = (secret.find("that") != string::npos);
    find_this = (secret.find("this") != string::npos);

    return (find_the || find_that || find_this);
}

string decipher(string secret){
    int gap = 1;
    string plain;
    bool check;
    
    //"the", "that", "this"
    check = isPlain(secret);
    
    if(check){
        plain = secret;
    }
    else {
        while(gap<=26){
            string::iterator it = secret.begin();
            for (; it != secret.end(); it += 1){
                if('a'<=*it & *it <='z')
                    *it = (*it!='z') ? *it + 1 : 'a';
                //cout << *it;
            }
            //cout << endl;
            gap++;
            if(isPlain(secret)) break;
        }
    }
    return secret;
}


int main (int argc, char const* argv[]){
    string secret, plain;
    
    //暗号文の取得
    getline(cin,secret);
    
    
    //暗号解読
    plain = decipher(secret);
    
    //平文の出力
    cout << plain << endl;
    
    return 0;
}

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

using namespace std;

int main()
{
	string str;
	
	while (getline(std::cin, str), !str.empty()){
		int j = 0;
		int di = 0;
		for (int i = 0; i < str.size(); i++){
			if (str[i] == ' '){
				if (i - j < 5 && i - j > 1){
					if (str[j] - str[j + 1] == 12){
						if (str[j + 1] - str[j + 2] == 3){
							di = str[j] - 't';
							break;
						}
						else if (str[j + 1] - str[j + 2] == -1){
							if (str[j + 2] - str[j + 3] == -10){
								di = str[j] - 't';
								break;
							}
						}
						else if (str[j + 1] - str[j + 2] == 7){
							if (str[j + 2] - str[j + 3] == -19){
								di = str[j] - 't';
								break;
							}
						}
					}
					
				j = i + 1;
				}
			}
		}
		
		for (int i = 0; i < str.size();i++){
			if ('a' <= str[i] && str[i] <= 'z'){		
				str[i] = str[i] - di;
			}
		}
		
		cout << str << endl;
	}
}

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

int main() {
  char s[100];
  while (fgets(s, sizeof(s), stdin)) {
    while (1) {
      for (int i = 0; s[i] != '\0'; i++) {
        if (s[i] >= 'a' && s[i] < 'z') s[i]++;
        else if (s[i] == 'z') s[i] = 'a';
        else if (s[i] == '\n') s[i] = '\0';
      }
      if (strstr(s, "the") || strstr(s, "this") || strstr(s, "that")) break;
    }
    puts(s);
  }
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};

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


  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;

vector<string> aa;

int main()
{
	string a;

	getline(cin, a);

	auto left = a.begin();
	
	while (true){
		auto right = left;
		while (right != a.end() && *right != ' ')++right;

		aa.emplace_back(left,right);
		if (right == a.end())
			break;
		++right;
		left = right;
	}
	

	string c[3] = { "this", "that" , "the"};

	vector<string> nn;
	vector<string> kk;
	for (auto x : aa){
		auto n = x.length();
		if (n == 3){
			kk.push_back(x);
		}
		if (n == 4){
			nn.push_back(x);
		}
	}

	for (auto x : kk){
		auto n1 = x[0] - c[2][0];
		bool f(true);

		for (int i = 1; i < 3; ++i){
			if (n1 != x[i] - c[2][i])
				f = false;
		}

		if (f){
			int i(0);
			for (auto x : aa){
				for (auto y : x){
					if (y == '.'){
						cout << y;
						continue;
					}

					int q = y - 'a';
					if (q - n1 < 0){
						q = 27 - n1;
					}
					else
						q -= n1;

					cout << (char)(q + 'a');
				}
				if (i < aa.size() - 1)
					cout << " ";
				++i;
			}
			cout << endl;
			return 0;
		}
	}

	for (auto x : nn){
		auto n1 = x[0] - c[0][0];
		auto n2 = x[0] - c[1][0];
		bool f(true);
		bool f2(true);

		for (int i = 1; i < 4; ++i){
			if (n1 != x[i] - c[0][i])
				f = false;
			if (n2 != x[i] - c[1][i])
				f2 = false;
		}

		if (f){
			int i(0);
			for(auto x : aa){
				for (auto y : x){
					if (y == '.'){
						cout << y;
						continue;
					}

					int q = y - 'a';
					if (q - n1 < 0){
						q = 27 - n1;
					}
					else
						q -= n1;

					cout << (char)(q + 'a');
				}
				if (i < aa.size()-1)
					cout << " ";
				++i;
			}
			cout << endl;
			return 0;
		}
		else if (f2){
			int i(0);
			for (auto x : aa){
				for (auto y : x){
					if (y == '.'){
						cout << y;
						continue;
					}

					int q = y - 'a';
					if (q - n2 < 0){
						q = 27 - n2;
					}
					else
						q -= n2;

					cout << (char)(q+'a');
				}
				if (i < aa.size() - 1)
					cout << " ";
				++i;
			}
			cout << endl;
			return 0;
		}

	}
	return 0;
}