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 s;
  while(getline(cin,s)){
    //cout << s << endl;
    string a="abcdefghijklmnopqrstuvwxyz";
    a += a;

    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;

string change(string s,int num){

	for(int i=0;i<s.size();i++){
		if(s[i]+num>'z')s[i]=(s[i]+num-'z'+'a'-1);
		else s[i]=(s[i]+num);
	}
	return s;
}
char change(char c,int num){
	char re;
	if(c+num>'z')re=c+num-'z'+'a'-1;
	else re=c+num;
	return re;
}

int solve(string s){
	string now;
	
	for(int i=0;i<s.size();i++){
		if(s[i]>='a' && s[i]<='z')now+=s[i];
		else {
			for(int j=0;j<=26;j++){
				string tmp=change(now,j);
				if(tmp=="the" || tmp=="this" || tmp=="that"){
					return j;
				}
			}
			now.clear();
		}
	}
}

string ans(string s){
	int n=solve(s);
	string ans;
	for(int i=0;i<s.size();i++){
		if(s[i]>='a' && s[i]<='z')ans+=change(s[i],n);
		else ans+=s[i];
	}
	return ans;
}

int main(){
	string str;
	
	while(getline(cin,str)){
		cout<<ans(str)<<endl;
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

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

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

bool valid(string line){
  string t[3] = {"the", "this", "that"};
  for ( int i = 0; i < 3; i++ ){
    if ( line.find(t[i]) != string::npos ) return true;
  }
  return false;
}

void move(string &line){
  for ( int i = 0; i < line.size(); i++ ){
    if ( line[i] == 'a' ) line[i] = 'z';
    else if ( 'b' <= line[i] && line[i] <= 'z' ){
      line[i] = (char)(line[i]-1);
    }
  }
}
main(){
  string line;
  while(1){
    getline(cin, line);
    if ( cin.eof() ) break;
    while(1){
      if ( valid(line) ) {
	cout << line << endl;
	break;
      }
      move(line);
    }
  }
}

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

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-6

using namespace std;

bool f(string a){

	string::size_type p=a.find("the");
	string::size_type q=a.find("this");
	string::size_type r=a.find("that");
	if(p!=string::npos || q!=string::npos || r!=string::npos)
	return true;
	else return false;

	}

int main(){

   string s,s1;

   while(true){

	getline(cin,s);
	if(cin.fail()) break;

	int n=s.size();

	REP(k,1,25){
	s1=s;
	rep(i,n){
	if('a'<=s1[i] && s1[i]<='a'-1+k) s1[i]+=26-k;
	if('a'+k<=s1[i] && s1[i]<='z') s1[i]+=-k;
	}

	if(f(s1)){ cout << s1 << endl; break; }

	}


	}


    return 0;
}

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

int main(int argc, char *argv[]){
	string s;
    while(getline(cin,s)){
		int c=0;
		while((s.find("that") ==string::npos 
			  && s.find("the") ==string::npos
			  && s.find("this") ==string::npos) 
			 && c<26){
			for (int i = 0; i < s.length(); ++i){
				if(s[i]<'z' && s[i] >='a') s[i]++;
				if(s[i]=='z') s[i]='a';
			}
		    
			c++;
		}
		cout<<s<<endl;
	}
    return 0;
}

C++: #include<string>
#include<iostream>
#include<algorithm>
using namespace std;
string henkan(string a)
{
	for (unsigned int i = 0; i < a.size(); i++)
	{
		if (a[i] != ' '&&a[i] != '.'&&a[i]!='\n')
		{
			if (a[i] == 'z')a[i] = 'a';
			else 
				a[i] += 1;
		}
	}
	return a;
}
bool check(string a)
{
	string x[3] = { "the", "this", "that" };
	for (int i = 0; i < 3; i++)
	{
		if (a.find(x[i], 0) != string::npos)return false;
	}
	return true;
}
int main()
{
	
	string a, b;
	cin >> b;
	a.append(b);
	while (getline(cin,b))
	{
		a.append(b);
		a.append("\n");
	}
	while (check(a))
	{
		a = henkan(a);
	}
	cout << a << endl;
	
}

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

int main(){
	string a;
	while (getline(cin, a)){
		for (int i = 0; i < 26; i++){
			if (a.find("the") != string::npos || a.find("this") != string::npos || a.find("that") != string::npos){
				cout << a << endl;
			}

			for (int j = 0; j < a.size(); j++){
				if (a[j] == ' '){
					continue;
				}
				else if (a[j] == 'z'){
					a[j] = 'a';
				}
				else if (a[j] == '.'){
					continue;
				}
				else {
					a[j]++;
				}
			}

		}

	}

	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
void slide(string& s) {
  for (auto& c : s)
    if (c == 'a') c = 'z';
    else if (c != '.' && c != ' ') c -= 1;
}
bool check(const string& s) {
  if (s.find("the") == string::npos || s.find("this") == string::npos
    || s.find("that") == string::npos) return true;
  return false;
}
int main() {
  string line;
  while (getline(cin, line)) {
    while (check(line))
      slide(line);
    cout << line << endl;
  }
}