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;

string rotate(string S, int a){
  for(int i=0; i<S.length(); i++){
    if(S[i] != ' ' && S[i] !=  '.'){
      S[i] = (S[i] -'a' + a) % 26 + 'a';
    }
  }
  return S;
}





int main(){
  string S;
  
  while(getline(cin, S)){
    for(int i=0; i<26; i++){
      string T = rotate(S, i); bool flag = false;

      for(int j=0; j<S.length(); j++){
        if(T[j] == 't' && T[j+1] == 'h' && T[j+2] == 'e'){
          cout << T << endl; flag = true; break;
        } else if (T[j] == 't' && T[j+1] == 'h' && T[j+2] == 'i' && T[j+3] == 's'){
          cout << T << endl; flag = true; break;
        } else if (T[j] == 't' && T[j+1] == 'h' && T[j+2] == 'a' && T[j+3] == 't'){
          cout << T << endl; flag = true; break;
        }
      }

      if (flag) break;
    }
  }
}

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