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 <stdio.h>

int main(void)
{
	char str[80];
	int num, num2;
	int i;
	
	while (fgets(str, 80, stdin) != NULL){
		num = 't' - str[0];
		i = 0;
		while (str[i] != '\0'){
			if (str[i] + num >= 'a' && str[i] + num <= 'z'){
				str[i] += num;
				if (str[i] > 'z'){
					num2 = str[i] - 'z';
					str[i] = num2 + 'a';
				}
				else if (str[i] < 'a'){
					num2 = 'a' - str[i];
					str[i] = 'z' - num2;
				}
			}
			i++;
		}
		printf("%s", str);
	}
	
	printf("\n");
	
	return (0);
}

C++: #include <stdio.h>
#include <string.h>

int
main(void)
{
	char line[100];
	char res[100];

	auto chksep = [](char c) -> bool {
			return (c == ' ' || c == '.' || c == '\n');
		};

	while (fgets(line, sizeof line, stdin)) {
		int len = strlen(line);
		int state = 0;
		
		for (int s = 0; s <= 26; s++) {
			for (int i = 0; i < len; i++) {
				if (chksep(line[i])) {
					res[i] = line[i];
				} else {
					int c = line[i] + s;
;					if (c > 'z') {
						res[i] = c - 'z' + 'a' - 1;
					} else {
						res[i] = c;
					}
				}

				switch (state) {
				case 0:
					if (res[i] == 't') {
						state = 1;
					}
					break;

				case 1:
					if (res[i] == 'h') {
						state = 2;
					} else {
						state = 0;
					}
					break;

				case 2:
					if (res[i] == 'e') {
						state = 5;
					} else if (res[i] == 'i') {
						state = 3;
					} else if (res[i] == 'a') {
						state = 4;
					} else {
						state = 0;
					}
					break;

				case 3:
					if (res[i] == 's') {
						state = 2;
					} else {
						state = 0;
					}
					break;

				case 4:
					if (res[i] == 't') {
						state = 2;
					} else {
						state = 0;
					}
					break;

				case 5:
					if (chksep(res[i])) {
						state = 99;
					} else {
						state = 0;
					}
					break;
				}
			}

			if (state == 99) {
				res[len] = 0;
				printf("%s", res);
				break;
			}
		}
	}

	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   vector<string> a;
   string b;
   while(cin>>b){
      REP(i,b.size()) if(b[i]!='.')b[i]-=4;
      a.PB(b);
   }
   REP(i,a.size()){
      cout << a[i];
      if(i!=a.size()) cout << " ";
   }
   cout << endl;
   return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int getShiftVal(string& line){
	int s = line.size();
	string::size_type ps = 0, pe = 0;
	while (true){
		while (ps < s && line[ps] == ' ') ++ps;
		pe = ps;
		while (pe < s && line[pe] != ' ') ++pe;
		if (ps == s || pe == s)
			break;
		int len = pe - ps;
		if (3 == len){
			if (line[ps] == line[ps + 1] + 12 && line[ps] == line[ps + 2] + 15){
				return int('t' - char(line[ps]));
			}
		}
		else if (4 == len){
			if (line[ps] == line[ps + 1] + 12 && line[ps] == line[ps + 2] + 11 && line[ps] == line[ps + 3] + 1){
				return int('t' - char(line[ps]));
			}
			else if (line[ps] == line[ps + 1] + 12 && line[ps] == line[ps + 2] + 19 && line[ps] == line[ps + 3]){
				return int('t' - char(line[ps]));
			}
		}
		ps = pe;
	}
	return -1;
}

int main()
{
	string line;
	while (std::getline(cin, line)){
		int s = line.size();
		int v = getShiftVal(line);
		for (int i = 0; i < s; ++i){
			char c = line[i];
			if (c == ' ' || c == '.' || c == '\n') cout << c;
			else cout << char(c + v);
		}
		cout << "\n";
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  string s,t;
  while(getline(cin,s)){

    for(int i = 1 ; i <= 25 ; i++ ){
      t = "";
      for(int j = 0 ; j < (int)s.size() ; j++ ){
	if('a'<= s[j] && s[j]<= 'z'){
	  if((s[j] + i) > 'z')t+=(s[j] + i - 25);
	  else t+=(char)(s[j]+i);
	}
	else t += s[j];
      }
      if(t.find("the") != string::npos ||
	 t.find("this") != string::npos ||
	 t.find("that") != string::npos ){
	cout << t << endl;
	break;
      }
    }
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

char a[1000];
int b,c;

int main()
{
	while(fgets(a,999,stdin) != NULL)
	{
		c=0;
		while(true)
		{
			if(strstr(a,"this")!=NULL||strstr(a,"the")!=NULL||strstr(a,"that")!=NULL)break;
			for(b=0;a[b]!='\0';b++)
			{
				if(islower(a[b]))
				a[b]++;
				if(a[b]>122)
				a[b]=97;
			}
			c++;
			if(c>27)
			break;
		}
		printf("%s",a);
	}
	return 0;
}