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<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

template<class T>
inline bool chmax(T& a, T b){if(a<b){a=b;return true;} return false;}

template<class T>
inline bool chmin(T& a, T b){if(a>b){a=b;return true;} return false;}

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll nCrmod(ll n,ll r){ll x=1,y=1; rep(i,r){x=x*(n-i)%mod; y=y*(i+1)%mod;} return x*powmod(y,mod-2)%mod;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	string s;
	while(getline(cin,s)){
		ll n=s.length();
		while(1){
			if(s.find("this")!=string::npos) break;
			if(s.find("that")!=string::npos) break;
			if(s.find("the")!=string::npos) break;
			rep(i,n){
				if(s[i]!=' ' && s[i]!='.'){
					if(s[i]=='z') s[i]='a';
					else s[i]++;
				}
			}
		}
		cout << s << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

inline char _rotate(char c, char df) {
    int x = c + (26 - df - 'a');
    return x % 26 + 'a';
}
inline char rotate(char c, char df){
    if(isalpha(c)){
        c = _rotate(c, df);
    }
    return c;
}

inline char decode_from_t(char t, char tgt){
    int df = ('t' - t);
    return _rotate(tgt, df);
}

char buf[82];

inline bool is_sep(char *c){
    return *c == ' ' || *c == '.' || *c == '\n';
}

inline int df(char *l, int next){
    return *(l+next) - *(l + 1 + next);
}

inline int df(char l, char r){
    return l - r;
}

// return rot.
int findTheThatThis(){
    char *f_sep, *b_sep = buf - 1;
    char d_the[][2] = { {-14, 3},{12, -23},{12, 3} }; // the
    char d_this_that[][3] = {
        {-14, -1, -10}, {-14, -1, 16}, {-14, 25, -10}, {12, -1, -10}, // this
        {-14, 7, 7}, {12, -19, 7}, {12, 7, -19}, // that
    };
    bool found = false;

    do {
        f_sep = b_sep;
        while (!is_sep(++b_sep));
        //for_each(f_sep, b_sep, [](char x){ putchar(x); }); putchar('\n');
        if(b_sep - f_sep - 1== 3){
            int buf[2] = { df(f_sep,1), df(f_sep,2) };
            for (int i = 0; i < sizeof(d_the); i++) {
                if(d_the[i][0] == buf[0] && d_the[i][1] == buf[1]){
                    found = true;
                    break;
                }
            }
        }else if(b_sep - f_sep - 1 == 4){
            int buf[3] = { df(f_sep,1), df(f_sep,2), df(f_sep,3)};
            for (int i = 0; i < sizeof(d_this_that); i++) {
                if(d_this_that[i][0] == buf[0] && d_this_that[i][1] == buf[1] && 
                        d_this_that[i][2] == buf[2]){
                    found = true;
                    break;
                }
            }
        }
        if(found) return *(f_sep+1) - 't';
    } while (*b_sep != '\n');

    // not found
    return 0;
}

int main(int argc, char const* argv[])
{
    int dif;

    while (nullptr != fgets(buf, 82, stdin)) {
        dif = findTheThatThis();
        for (int i = 0; ; i++) {
            if(buf[i] == '\n'){
                buf[i] = '\0';
                puts(buf);
                break;
            }
            buf[i] = rotate(buf[i], dif);
        }
    }

        return 0;
}

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

using namespace std;

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