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<iostream>
#include<map>
#include<string>
using namespace std;

typedef pair<string, string> P;

P next_word(string sentence) {
  if (sentence.empty()) return make_pair(string(""), string(""));
  if (sentence[0] == ' ' || sentence[0] == '.') {
    return make_pair("", sentence.substr(1));
  } else {
    P recur = next_word(sentence.substr(1));
    return make_pair(sentence[0] + recur.first, recur.second);
  }
}

bool acceptable(string sentence) {
  P p = next_word(sentence);

  while (! p.first.empty() ) {
    if (p.first == "this" || p.first == "the" || p.first == "that")
      return true;

    p = next_word(p.second);
  }
  return false;
}

char slip(char c) {
  if (c < 'a' || 'z' < c) return c;
  
  string alphabet = "abcdefghijklmnopqrstuvwxyza";
  int index = (int)(c - 'a');
  return alphabet[index + 1];
}

char slip(char c, int n) {
  for (int i = 0; i < n; i++)
    c = slip(c);

  return c;
}

string slip(string code, int n) {
  string val;
  for (int i = 0, len = code.length(); i < len; i++)
    val += slip(code[i], n);

  return val;
}

string decode(string code) {
  for (int i = 1; i < 27; i++) {
    string sentence = slip(code, i);
    if (acceptable(sentence))
      return sentence;
  }

  return "";
}

int main() {
  string code;
  while ( getline(cin, code) )
    cout << decode(code) << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string s;
  int pl=0;
  getline(cin,s);
  for(int i =-30;i<30;i++){
    for(int j = 0; j < s.size()-3; j++){
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'e'&& s[j+3]==' '){
	pl = i;
	break;
      }
      if(j==s.size()-1) break;
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'a' && s[j+3]+i=='t' && s[j+4]==' '){
	pl = i;
	break;
      }
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'i' && s[j+3]+i=='s' && s[j+4]==' '){
	pl = i;
	break;
      }
    }
    if(pl!=0) break;
  }
  for(int i=0;i <s.size();i++){
    if(s[i]<='z' && s[i]>='a') s[i] += pl;
  }
  cout<<s<<endl;
}

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

		for (int j = 0; j < 26; j++) {
			for (int i = 0; i < key.size(); i++) {
				if (key[i] >= 'a' && key[i] <= 'z') {
					key[i] = (key[i] == 'z') ? 'a' : key[i] + 1;
				}
			}

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

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable:4996)

bool Check(char* Str);

int main()
{

	int  nCnt = 0;
	char PhraseIn[80];
	char PhraseOut[80] = "\0";
	int  nSlide = 1;

	gets(PhraseIn);

	while (1)
	{
		for (nCnt = 0; PhraseIn[nCnt] != '\0'; nCnt++)
		{
			if (PhraseIn[nCnt] == ' ' || PhraseIn[nCnt] == '.' || PhraseIn[nCnt] == '\n')
			{
				PhraseOut[nCnt] = PhraseIn[nCnt];
				continue;
			}

			PhraseOut[nCnt] = PhraseIn[nCnt] - nSlide;

			if (PhraseOut[nCnt] > 122)
				PhraseOut[nCnt] = 97 + (nSlide-1);

			if (PhraseOut[nCnt] < 97)
				PhraseOut[nCnt] = 122 - (nSlide - 1);
		}

		if (Check(PhraseOut))
			break;
		else
			nSlide++;
	}

	printf("%s", PhraseOut);


	return 0;
}

bool Check(char* Str)
{
	int nCnt = 0;
	int nCnt2 = 0;
	char Work[10] = "\0";

	while (Str[nCnt] != '\0')
	{
		Work[0] = '\0';
		nCnt2 = 0;
		while (1)
		{
			if (Str[nCnt] == ' ' || Str[nCnt] == '.' || Str[nCnt] == '\n' || Str[nCnt] == '\0')
			{
				nCnt++;
				break;
			}

			Work[nCnt2] = Str[nCnt];
			nCnt++;
			nCnt2++;
		}

		if (strcmp(Work, "this") == 0 || strcmp(Work, "the") == 0 || strcmp(Work, "that") == 0)
			return true;
	}

	return false;
}

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

using namespace std;


//the this that を探す
bool found(string s){
	if ((s.find("the") != -1) || (s.find("this") != -1) || (s.find("that") != -1))
		return true;
	else
		return false;
}


int main(){

	string str;
	getline(cin, str);
	string ans=str;

	int j = 0;

	while (!found(ans)){
		j++;
		for (int i = 0; i < str.size(); i++){
			if 
				(ans[i] == ' ') ans[i] = ans[i];
			else if 
				(ans[i] == '.') ans[i] = ans[i];
			else
				ans[i] = ((int)str[i] + j)>(int)'z' ? (char)((int)str[i] + j - 26) : (char)((int)str[i] + j);
		}
		if(found(ans)) break;
	} 
	
	cout << ans << endl;

	return 0;

}

C++: #include<cstring>
#include<cstdio>
#include<iostream>

#define REP(n) for(int i=0;i<n;i++)

using namespace std;


int main(){
	char a[100];

	while(NULL!=fgets( a, 80, stdin)){
		int n=strlen(a);

		while(NULL==strstr(a,"the")&&NULL==strstr(a,"this")&&NULL==strstr(a,"that")){
			REP(n){
				if('a'<=a[i] && a[i]<'z')	a[i]++;
				else if('z'==a[i]) a[i]='a';
			}
		}

	printf("%s",a);
	}

	return 0;
}