Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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 scanner.Scan() {
		infos := strings.Split(scanner.Text(), " ")
		plain := make([]string, len(infos))
		// 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 <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;
}

C++: #include <iostream>
#include <string>
using namespace std;
int getShiftVal(string& line){
	int s = line.size();
	string::size_type ps = 0, pe = 0;
	while (true){
		while (ps < s && line[ps] == ' ') ++ps;
		pe = ps;
		while (pe < s && line[pe] != ' ') ++pe;
		if (ps == s || pe == s)
			break;
		int len = pe - ps;
		if (3 == len){
			if (line[ps] == line[ps + 1] + 12 && line[ps] == line[ps + 2] + 15){
				return int('t' - char(line[ps]));
			}
		}
		else if (4 == len){
			if (line[ps] == line[ps + 1] + 12 && line[ps] == line[ps + 2] + 11 && line[ps] == line[ps + 3] + 1){
				return int('t' - char(line[ps]));
			}
			else if (line[ps] == line[ps + 1] + 12 && line[ps] == line[ps + 2] + 19 && line[ps] == line[ps + 3]){
				return int('t' - char(line[ps]));
			}
		}
		ps = pe;
	}
	return -1;
}

int main()
{
	string line;
	std::getline(cin, line);
	int s = line.size();
	int v = getShiftVal(line);
	for (int i = 0; i < s; ++i){
		char c = line[i];
		if (c == ' ' || c == '.' || c == '\n') cout << c;
		else cout << char(c + v);
	}
	cout << "\n";
	return 0;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	string s;
	string ans;
	bool flag = false;
	int key = 1;
	while(cin >> s) ans += s + " ";
	ans.erase(ans.size());
	while(1) {
		rep(i, ans.size()) {
			if(97 <= ans[i] && ans[i] <= 122) {
				int number = (ans[i] - 'a' + key) % 26;
				ans[i] = 'a' + number;
			}
		}
		string tmp;
		rep(i, ans.size()) {
			if(97 <= ans[i] && ans[i] <= 122) tmp += ans[i];
			else if(ans[i] == ' ') {
				if(tmp == "this" || tmp == "the" || tmp == "that") flag = true;
				else tmp.erase(tmp.begin(), tmp.end());
			}
		}
		if(flag) break;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  string str;

  while(getline(cin,str)){
    int flg = 0;

    while(true){
      for(int i = 0 ; i < str.length() ; i++){
	string key1 = str.substr(i,3),key2 = str.substr(i,4);
	if(key1 == "the" || key2 == "that" || key2 == "this") flg = 1;
      }

      if(flg) break;
      else{
	for(int j = 0 ; j < str.length() ; j++){
	  if('a' <= str[j] && str[j] <= 'z'){
	    str[j] -= 'a' - 'A';
	    str[j] = (char)('A'+(str[j]-'A'+26+1)%26);
	    str[j] += 'a' - 'A';
	  }
	  else continue;
	}
      }
    }
    cout << str << endl;
  }

  return 0;
}

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

using namespace std;

string line;
int str_len;

bool is_finish() {
  for(int i=0; i<str_len-3; i++) {
    if(line[i] == 't') {
      if(line[i+1] == 'h') {
        if(line[i+2] == 'e') { return true; }
        else if(line[i+2] == 'i' && line[i+3] == 's') { return true; }
        else if(line[i+2] == 'a' && line[i+3] == 't') { return true; }
      }
    }
  }
  return false;
};


int main() {
  while(getline(cin, line)) {
    str_len = line.length();

    for(int j=0; j<26; j++) {
      if(is_finish()) { 
        cout << line << endl;
        break; 
      }

      for(int j=0; j<str_len; j++) {
        if('a' <= line[j] && line[j] < 'z') {
          line[j] += 1;
        }
        else if(line[j] == 'z') {
          line[j] = 'a';
        }
      }
    }
  }
  return 0;
}

C++: #include <stdio.h>
#include <string.h>

int main(void){
    char buf[128];
    bool found;
    
    gets(buf);
    for(int i=0; i<26; i++){
        found = false;
        if (strstr(buf, "th")){
            found = (strstr(buf,"the") != NULL);
            found |= (strstr(buf,"this") != NULL);
            found |= (strstr(buf,"that") != NULL);
        }
        if (found) break;
        for (char *p = buf; *p != '\0'; p++){
            if (*p >= 'a' && *p <= 'z'){
                *p = (*p - 'a' + 1) % 26 + 'a';
            }
        }
    }
    printf("%s",buf);
    
    return 0;
}