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 <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>

using namespace std;


int main(){

	string line;

	while(getline(cin, line)){

		string str[80], ans[80];
		int count = 0;
		int flag = 0;
		int slide;

		//???????????????????????¨???????´?
		for(int i=0 ; i<line.size()-1 ; i++){
			if(line[i] == ' '){
				count++;
			}else{
				str[count] += line[i];
				ans[count] = str[count];
			}
		}


		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<=count ; j++){
				for(int k=0 ; k<str[j].size() ; k++){
					if(str[j][k] != '.'){
						str[j][k]++;
						if(str[j][k] > 'z'){
							str[j][k] = str[j][k] - 'z' + 'a' -1;
						}
					}
				}

				if(str[j] == "this" || str[j] == "the" || str[j] == "that"
						|| str[j] == "this." || str[j] == "the." ||str[j] == "that."){
					flag = 1;
					slide = i+1;
					break;
				}
			}
			if(flag == 1)break;
		}

		for(int i=0 ; i<=count ; i++){
			for(int j=0 ; j<ans[i].size() ; j++){
				if(ans[i][j] != '.'){
					if((ans[i][j] + slide) > 'z' ){
						ans[i][j] = ans[i][j] - 'z' + 'a' -1 + slide;
					}else{
						ans[i][j] += slide;
					}
				}
			}
		}

		for(int i=0 ; i<count ; i++){
			cout << ans[i] << ' ';
		}
		cout << ans[count] << endl;

	}
	return 0;
}

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

using namespace std;

int main() {
	string str;
	string in;
	vector<string> s;
	while (cin >> in) s.push_back(in);
	for (int i=0; i<(int)s.size(); i++) {
		str += s[i];
		if (i<(int)s.size()-1) str += " ";
	}
	
	for (int i=0; i<26; i++) {
		if (str.find("the")!=str.npos || str.find("this")!=str.npos || str.find("that")!=str.npos) break;
		for (int j=0; j<(int)str.size(); j++) {
			if (str[j] == '.' || str[j] == ' ') continue;
			str[j] = 'a' + (str[j] - 'a' + 1)%26;
		}
	}
	
	cout << str << endl;
	
	return 0;
}

C++: #include <cstdio>
#include <string>
#include <vector>
#include <map>
using namespace std;
static map<char, int> create_map() {
    map<char, int> m;
    string base = "abcdefghijklmnopqrstuvwxyz";
    for (int i = 0; i < 26; i++) m.insert({base[i], i});
    return m;
}
static map<char, int> m = create_map();
static string base = "abcdefghijklmnopqrstuvwxyz";
string str;
static int t1[4] = {0, 14, 7, 0}; //that
static int t2[4] = {0, 14, 15, 25}; //this
static int t3[3] = {0, 14, 11}; //the
int cdiff;

int main(void){

    char chs[81];
    while(fgets(chs, 81, stdin) != 0){
        str = chs;
        cdiff = 27;
        int sidx;
        for (int i = 0; i < str.size()-2; i++) {
            if (cdiff != 27) break;
            sidx = m[str[i]];
            //if character is a space or a point or distance between current and next character is not that we expected...
            if (str[i+1] == '.' || str[i+1] == ' ' || base[(sidx+t3[1])%26] != str[i+1]) continue;
            if (str[i+2] != '.' && str[i+2] != ' ' && base[(sidx+t3[2])%26] == str[i+2]) { cdiff = sidx - m['t']; break; }
            if (i < str.size()-3) {
                if (str[i+2] == '.' || str[i+3] == '.' || str[i+2] == ' ' || str[i+3] == ' ') continue;
                if (base[(sidx+t1[2])%26] == str[i+2] && base[(sidx+t1[3])%26] == str[i+3]) { cdiff = sidx-m['t']; break; }
                if (base[(sidx+t2[2])%26] == str[i+2] && base[(sidx+t2[3])%26] == str[i+3]) { cdiff = sidx-m['t']; break; }
            }
        }
        map<char, char> m2;
        for (int i = 19; i < 45; i++) m2.insert({base[(cdiff+i)%26], base[i%26]});
        m2.insert({'.', '.'}); m2.insert({' ', ' '});
        string str2 = "";
        for (int i = 0; i < str.size(); i++) {
            str2 += m2[str[i]];
        }
        printf("%s\n", str2.c_str());
    }


    return 0;
}

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

// determine whether it is "the","this" or "that"
char get_shift(string w) {
	char sh = 't' - w.front();
	for_each(w.begin(),w.end(),[sh](char &c) {
		c += sh;
		if (c > 'z') {
			c -= (char)26;
		} else if (c < 'a') {
			c += (char)26;
		}
	});
	if (w != "the" && w != "this" && w != "that") {
		sh = '\0';
	}
	return sh;
}

int main() {
	string s;
	while (getline(cin,s)) {
		istringstream stream(s);
		string w;
		char sh;
		while (stream >> w) {
			while (!w.empty() && w.front() == '.') {
				w.erase(0,1);
			}
			while (!w.empty() && w.back() == '.') {
				w.pop_back();
			}
			if (!w.empty()) {
				if ((sh = get_shift(w)) != '\0') {
					break;
				}
			}
		}
		for_each(s.begin(),s.end(),[sh](char &c) {
			if (c >= 'a' && c <= 'z') {
				c += sh;
				if (c > 'z') {
					c -= (char)26;
				} else if (c < 'a') {
					c += (char)26;
				}
			}
		});
		cout << s << endl;
	}
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    string s;
    getline(cin,s);

    while(1){
        if( s.find("this")!=string::npos || s.find("that")!=string::npos ||s.find("the")!=string::npos )break;
        rep(i,s.size()){
            if(s[i]<='z' && s[i]>='a'){
                if(s[i]=='a')s[i]='z';
                else{
                    s[i]--;
                }
            }
        }
    }
    cout<<s<<endl;
    
    
    return 0;
}

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

using namespace std;

int main() {
	string str, str2, ans;
	int i, j, l, n = 0;
	while (cin >> str) {
		ans += str;
		ans += ' ';
		if (n != 0) {
			continue;
		}
		l = str.length();
		str2.resize(l);
		for (i = 1; i < 26; i++) {
			for (j = 0; j < l; j++) {
				if (str[j] == '.') {
					continue;
				}
				if (str[j] + i > 'z') {
					str2[j] = str[j] - 26 + i;
				}
				else {
					str2[j] = str[j] + i;
				}
			}
			if (str2 == "the" || str2 == "the." || str2 == "this" || str2 == "this." || str2 == "that" || str2 == "that.") {
				n = i;
				break;
			}
		}
	}
	l = ans.length();
	ans.erase(l - 1);
	for (i = 0; i < l; i++) {
		if (ans[i] == '.' || ans[i] == ' ') {
			continue;
		}
		if (ans[i] + n > 'z') {
			ans[i] = ans[i] - 26 + n;
		}
		else {
			ans[i] = ans[i] + n;
		}
	}
	cout << ans << endl;
	return 0;
}