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>

using namespace std;
int main()
{
	char key[100];

	while (cin >> key){

	for (int i = 0; i < sizeof(key); i++)
	{
		//if (key[i] == (int)" ")cout << "space";
		if ((int)key[i] <= 122 && (int)key[i] >= 97)
		key[i] = (int)key[i] - 1;
		if (key[i] == 96)key[i] = 122;
	}
	for (int i = 0; i < sizeof(key); i++)
		cout << key[i];
	}
	return 0;
}

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

using namespace std;

string str;

bool caesar()
{
	bool flag = false;

	for (int i=0; i<(int)str.size() - 2; i++)
	{
		if(str[i] == 't' && str[i+1] == 'h') {
			if(str[i+2] == 'e' && (str[i+3] == ' ' || str[i+3] == '\0' || str[i+3] == '.')) {
				flag = true;
				break;
			}
			if(str[i+2] == 'i' && str[i+3] == 's' && (str[i+4] == ' ' || str[i+4] == '\0' || str[i+4] == '.')) {
				flag = true;
				break;
			}
			if(str[i+2] == 'a' && str[i+3] == 't' && (str[i+4] == ' ' || str[i+4] == '\0' || str[i+4] == '.')) {
				flag = true;
				break;
			}
		}
	}

	return flag;
}


int main()
{
	while(getline(cin, str))
	{
		for (int i=0; i<26; i++)	//0〜25文字ずれるまで繰り返す
		{
			if(caesar()) {
				cout << str << endl;
			}

			//cout << str << endl;	//Debug

			for (int j=0; str[j] != '\0'; j++) {
				if(str[j] != ' ' && str[j] != '.') {
					if(str[j] == 'z') {
						str[j] = 'a';
					}
					else {
						str[j]++;
					}
				}
			}
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define li long long int
#define ld long long double
#define PI 3.1415926535897932384626
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

char str[85];
char word[3][5]={"the","this","that"};
char sent[80][80]={};
int main()
{
  bool ans=false;
  while(1){
    int i=0,j=0;
    int num=0;
    gets(str);
    if(strlen(str)==0)break;
    scanf("%*c");
    for(i=0;num<strlen(str);i++){
      for(j=0;;j++){
	sent[i][j]=str[num];
	num++;
	if(sent[i][j]==' '){
	  sent[i][j]='\0';
	  break;
	}
	if(sent[i][j]=='\0')break;
      }
    }
    //cout<<i<<endl;
    int gap,k,l;
    
    rep(gap,26){
      rep(k,i) rep(l,strlen(sent[k])){
	if(sent[k][l]>='a' && sent[k][l]<'z')
	   sent[k][l]++;//??????????????????
	else if(sent[k][l]=='z')
	  sent[k][l]='a';
      	//cout<<sent[k][l];//debug
      }
      // cout<<endl;//debug
      rep(k,i)
	if(strcmp(sent[k],word[0])==0 || strcmp(sent[k],word[1])==0 
	   || strcmp(sent[k],word[2])==0){
	  rep(l,i){
	    for(int a=0;a<strlen(sent[l]);a++)
	      cout<<sent[l][a];
	    if(l<i-1)
	      cout<<" ";
	    else
	      cout<<endl;
	  }
	  ans=true;
	  break;
	}
      if(ans)break;
    }
  }
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int gap = 0;
	string s;
	while(getline(cin, s)) {
		for (int i = 0; i < 3; ++i) {
			for (int j = 0; j < 'z' - 'a' + 1; ++j) {
				string cs;
				if (i == 0) cs = "the";
				if (i == 1) cs = "that";
				if (i == 2) cs = "this";
				for (int k = 0; k < cs.length(); ++k) {
					int sum;
					sum = (cs[k] - 'a' + j) % ('z' - 'a' + 1);
					cs[k] = 'a' + sum;
				}
				if (s.find(cs) != string::npos) {

					gap = j;
					break;
				}
			}
			if (gap != 0) break;
		}
		for (int i = 0; i < s.length(); ++i) {
			if ('a' <= s[i] && s[i] <= 'z') {
				int sum;
				sum = (s[i] - 'a' - gap + 'z' - 'a' + 1) % ('z' - 'a' + 1);
				s[i] = sum + 'a';
			}
		}
		cout << s << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>

void q17() {
	vector<string> hints;
	hints.push_back("the");
	hints.push_back("this");
	hints.push_back("that");

	vector< vector<string> > shiftHints;
	for (int i = 0; i < 26; i++) {
		vector<string> iShiftHints;
		for (int j = 0; j < hints.size(); j++) {
			string tmp = "";
			for (int k = 0; k < hints[j].length(); k++) {
				char z = ((hints[j][k] - 'a' + i) % 26) + 'a';
				tmp += ((hints[j][k] - 'a' + i) % 26) + 'a';
			}
			iShiftHints.push_back(tmp);
		}
		shiftHints.push_back(iShiftHints);
	}

	string str;
	for (; getline(cin, str);) {
		int s;
		bool flag = false;
		for (s = 0; s < 26; s++) {
			for (int i = 0; i < hints.size(); i++) {
				if (str.find(shiftHints[s][i]) != -1) {
					flag = true;
				}
			}
			if (flag) break;
		}

		string ans = "";
		for (int i = 0; i < str.length(); i++) {
			if ('a' <= str[i] && str[i] <= 'z') {
				ans += (str[i] - 'a' - s) % 26 + 'a';
			}
			else {
				ans += str[i];
			}
		}
		cout << ans << endl;
		break;
	}
}

int main() {
	q17();
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
      string s;
      while(getline(cin,s)||!cin.eof()){
            for(int i=0;i<25;i++){
                  if(s.find("the")!=-1||s.find("this")!=-1||s.find("that")!=-1)break;
                  else for(int j=0;j<s.size();j++)if(s[j]>='a'&&s[j]<='z')s[j]!='z'?s[j]++:s[j]='a';
            }
            cout<<s<<endl;
      }
}

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

using namespace std;

int main(){
  char a[100],b[100];
  for(int i;i<100;i++){
    a[i]='\0';
    b[i]='\0';
  }
  cin>>a;
  int i=0;
  while(i<26){
    for(int j=0;a[j]!='\0';j++){
      if(0x61<=a[j]+i&&a[j]+i<=0x7A)
	b[j]+=i;
      else if(0x61<=a[j]&&a[j]<=0x7A){
	b[j]=a[j]-26+i;
      }
    }
    if(strstr(b,"the")||strstr(b,"this")||strstr(b,"that"))
      break;
    i++;
  }
  for(int k=0;a[k]!='\0';k++)
    cout<<b[k];
  cout<<'\n';
  return 0;
}