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 <string>

char chshift(char ch){
  if(ch>='a' && ch<='z'){
    return (ch-'a'+1)%26+'a';
  }else{
    return ch;
  }
}

std::string strshift(std::string s){
  for(int i=0; i<s.length(); i++){
    s[i] = chshift(s[i]);
  }
  return s;
}

bool valid_text_p(std::string str){
  return str.find("the") != -1 || str.find("that") != -1 || str.find("this") != -1;
}

int main(){
  std::string s;
  while(std::getline(std::cin,s), !std::cin.eof()){
    for(;;s = strshift(s)){
      if(valid_text_p(s)){
	std::cout << s << std::endl;
	break;
      }
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

string str;

int main() {
	string str_copy;
	set<string> s;
	getline( cin, str );
	for ( int i = 1;; i++ ) {
		str_copy = str;
		for ( int j = 0; j < str_copy.size(); j++ ) {
			if ( str_copy[ j ] >= 'a' && str_copy[ j ] <= 'z' ) {
				str_copy[ j ] += 26;
				str_copy[ j ] -= i;
				str_copy[ j ] = ( ( str_copy[ j ] - 'a' ) % 26 ) + 'a';
			}
		}
		bool is_can = false;
		for ( int j = 0; j < str_copy.size() - 2; j++ ) {
			if ( str_copy.substr( j, 3 ) == "the" ) {
				is_can = true;
				break;
			}
		}
		for ( int j = 0; j < str_copy.size() - 3; j++ ) {
			if ( str_copy.substr( j, 4 ) == "that" || str_copy.substr( j, 4 ) == "this" ) {
				is_can = true;
				break;
			}
		}
		if ( is_can ) {
			break;
		}

	}
	printf( "%s\n", str_copy.c_str() );
	return 0;
}

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

int main() {
	string cipher;

	while (getline(cin, cipher)) {
		for (int i = 0; i < 26;i++) {
			for (unsigned int n = 0;n < cipher.length();n++) {
				if (cipher.at(n) == 'z') {
					cipher.at(n) = 'a';
				}
				else if (cipher.at(n) >= 'a'&&cipher.at(n) <= 'y') {
					cipher.at(n)++;
				}
			}

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

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<functional>
#include<deque>
#include<string.h>
#include<ctype.h>
#include<time.h>
#include<stdlib.h>
using namespace std;

char a[85];

bool search_th(){
  bool f = false;
  for (int i = 0; i < strlen(a); i++){
    if ((a[i] == 't' && a[i+1] == 'h' && a[i+2] == 'e') ||
        (a[i] == 't' && a[i+1] == 'h' && a[i+2] == 'i' && a[i+3] == 's') ||
        (a[i] == 't' && a[i+1] == 'h' && a[i+2] == 'a' && a[i+3] == 't')){
          f = true;  break;
    }
  }
  return f;
}

int main(){
  while (cin.getline(a, sizeof(a))){
    for (int i = strlen(a); i < 85; i++){
      a[i] = '\0';
    }
    while (1){
      if (search_th() == true){
        cout << a << endl;  break;
      }
      for (int j = 0; j < strlen(a); j++){
        if (a[j] >= 'a' && a[j] <= 'y') a[j]++;
        if (a[j] == 'z')                a[j] = 'a';
      }
      cout << a << endl;
    }
  }
  return 0;
}

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

using namespace std;
#define nofind string::npos

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

		pl = 0;

		for(int i = 0;i < 30;i++)
		{
			for(int j = 0; j < s.size(); j++)
			{
				if(islower(s[j]))
				{
					s[j]++;
				}
				if(s[j] > 'z')
				{
					s[j] -= 'z' - 'a' + 1;
				}
			}
			if(s.find("the") != nofind)
			{
				break;
			}
			if(s.find("this") != nofind)
			{
				break;
			}
			if(s.find("that") != nofind)
			{
				break;
			}
		}
		cout << s << endl;
	}
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	string st;
	vector<string>ths{ " the "," this "," that " };
	while (getline(cin, st)) {
		st.push_back(' ');
		st.insert(st.begin(), ' ');
		for (int i = 1; i < 26; ++i) {
			string nextst(st);
			for (auto&c : nextst) {
				int n = c - 'a';
				if (n < 0 || n >= 26)continue;
				n += i;
				n %= 26;
				c = 'a' + n;
			}
			bool ok = false;
			for (auto th : ths) {
				if (nextst.find(th) != -1)ok = true;
			}
			if (ok) {
				cout << nextst.substr(1,nextst.size()-2) << endl;
				break;
			}
		}
	}
	return 0;
}