Go: package main

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

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 reflect.DeepEqual(infos, []string{}) {
			break
		}
		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 <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

int main(int argc, char const *argv[]) {
  string a="abcdefghijklmnopqrstuvwxyz";
  a += a;

  string s;

  while(getline(cin,s)){
    //cout << s << endl;

    string t="";
    bool end=false;
    int i;
    for(int w=0; w<=25; ++w){
      //printf("w=%d\n", w);
      t="";
      int p=0;
      rep(i,s.size()){
        if('a'<=s[i] && s[i]<='z'){
          t+=a[s[i]-'a'+w];
        }
        else{
          t+=s[i];
          string tmp=t.substr(p,i-p);
          //cout << tmp << endl;

          if(tmp=="this" || tmp=="the" || tmp =="that") end=true;

          p=i+1;
        }
      }

      if(end) break;
    }

    std::cout << t << std::endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
    string input;
    const int alph_lim = 26;

    while (getline(cin, input, '\n')) {
        for (int i = 0; i < alph_lim; i++) {
            for (int j = 0; j < input.size(); j++) {
                if (islower(input[j])) {
                    input[j]++;
                    if (input[j] > 'z') 
                        input[j] -= alph_lim;
                }
            }

            if (input.find("the") != string::npos ||
                input.find("this") != string::npos ||
                input.find("that") != string::npos) {
                cout << input << endl;
                break;
            }
        }
    }

    return 0;
}

C++: #include<iostream>
#include<cstring>
#include<sstream>
using namespace std;
/*
string text = "hello world";
stringstream ss(text);
string t;
while (ss >> t){
*/
void fin(string a)
{
	a.erase(0,1);
	cout << a << endl;
	return;
}
int main()
{
	string a,b;
	bool fir=false;
	while (cin >> b)
	{
		a.append(" ");
		a.append(b);
		fir = true;
	}
	while (1)
	{
		if (a.find(" the ", 0) != string::npos||a.find(" the.",0)!=string::npos)
		{
			fin(a); return 0;
		}
		if (a.find(" this ", 0) != string::npos||a.find(" this.", 0) != string::npos)
		{
			fin(a); return 0;
		}
		if (a.find(" that ", 0) != string::npos || a.find(" that.", 0) != string::npos)
		{
			fin(a); return 0;
		}
		for (int i = 0; i < a.size(); i++)
		{
			if (a[i] != ' '&&a[i]!='.')a[i] += 1;
			if (a[i]>'z')a[i] = 'a';
		}
	}
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


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

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    char in[100];
    string S;
    vector<string> vec;
    
    while(EOF!=scanf("%s",in)){
        
        S = in;
        vec.push_back(S);
    }
    
    for(int k=0;k<26;k++){
        
        bool f = false;
        
        for(int i=0;i<vec.size();i++){
            for(int j=0;j<vec[i].size();j++){
                if(vec[i][j]!='.')vec[i][j]++;
                
                if(vec[i][j] > 'z') vec[i][j]='a';
            }
            
            if(vec[i]=="the" || vec[i]=="that" || vec[i]=="this" || vec[i]=="the." || vec[i]=="that." || vec[i]=="this."){
                
                f = true;
                
            }
        }
        
        if(f) break;
    }
    
    for(int i=0;i<vec.size();i++){
        cout << vec[i];
        if(i == vec.size()-1) cout << endl;
        else cout << " ";
    }
    
    return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main(){
    string s;
    while(getline(cin,s)){
        for(int i=0;i<26;i++){
            for(int j=0;j<s.length();j++)
                if(s[j]>='a'&&s[j]<='z')
                    s[j]='a'+(s[j]-'a'+1)%26;
            for(int j=2;j<s.length();j++){
                if(s[j]=='e'&&s[j-1]=='h'&&s[j-2]=='t'){
                    if((j-3<0||s[j-3]<'a'||s[j-3]>'z')&&((j==s.length()-1)||s[j+1]<'a'||s[j+1]>'z'))
                       goto next;
                    
                }
                if(j>2)
                    if((s[j]=='s'&&s[j-1]=='i'&&s[j-2]=='h'&&s[j-3]=='t')||(s[j]=='s'&&s[j-1]=='i'&&s[j-2]=='h'&&s[j-3]=='t'))
                        if((j-4<0||s[j-4]<'a'||s[j-4]>'z')&&((j==s.length()-1)||s[j+1]<'a'||s[j+1]>'z'))
                            goto next;
            }
        }
    next:cout<<s<<endl;
    }
}

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

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=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;
}