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>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PI;
using namespace std;
#define MAX  999999
int main(){
    string s;
    cin>>s;
    rep(i,27){
        rep(j,s.size()){
            if(s[j] != 'z')s[j] =s[j]+1;
            else s[j] = 'a';
        }
        if(s.find("this")!= string::npos){cout<<s<< endl;}
        else if(s.find("that")!= string::npos){cout<<s<< endl;}
        else if(s.find("the")!= string::npos){cout<<s<< endl;}


        }
}

C++: #include<iostream>
#include<string>
using namespace std;
char data[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int main(){
  string s[80];
  int count = 0;
  while(cin >> s[count]) count++;
  bool roop = true;
  while(roop){
    for(int i=0;i<count;i++){
      for(int j=0;j<s[i].size();j++){
	if(s[i][j]=='z') s[i][j] = 'a';
	if(s[i][j]=='.') continue;
	else s[i][j] = data[int(s[i][j]-'`')]; 
	//cout << s[i][j] << endl;
      }
      if(s[i]=="the"||s[i]=="this"||s[i]=="that") roop = false;
    }
  }
  for(int i=0;i<count;i++){
    cout << s[i];
    if(i!=count) cout << ' ';
  }
  cout << endl;
  return 0;
}

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

int main(){
	std::string s;
	std::getline(std::cin, s);
	for (int i = 0; i < 26; ++i){
		if (s.find("this") == std::string::npos && s.find("the") == std::string::npos && s.find("that") == std::string::npos){
			for (int j = 0; j < s.size(); ++j){
				if (s[j] != ' '&&s[j]!='.'){
					if (s[j] == 'z')s[j] = 'a';
					else s[j] += 1;
				}
			}
		}
		else{
			std::cout << s << std::endl;
			break;
		}
	}
	return 0;
}

C++: #include <stdio.h>

int str_len(char str[128]) {
	int i = 0;

	while(str[i]) i++;

	return i;
}

/* 二つの文字列が一致すれば1,一致しなければ0をかえす */
int str_comp(char str1[128], char str2[128]) {
	int len;
	int i;

	/* 文字列の長さが一致しなかった場合 */
	if((len = str_len(str1)) != str_len(str2))
		return 0;

	for(i = 0; i < len; i++) {
		if(str1[i] != str2[i])
			return 0;
	}

	return 1;
}

/* char1からchar2への準方向への差を求める */
int deff_two_char(char char1, char char2) {
	int ans;
	if((ans = char2 - char1) < 0)
		ans += 26;

	return ans;
}

/* 文字を順方向へdeffだけずらす */
char shift_letter_deff(int deff, char c) {
	char ans = c;

	if(c - 'a' + deff > 25)
		ans += deff - 26;
	else
		ans += deff;
	
	return ans;
}

/* 単語を準方向へdeffだけずらす */
void shift_deff(int deff, char str[128]) {
	int i = 0;

	while(str[i]) {
		str[i] = shift_letter_deff(deff, str[i]);
		i++;
	}
}

/* 文字列をコピー */
void str_cp(char str1[128], char str2[128]) {
	int i = 0;

	while(str1[i]) {
		str2[i] = str1[i];
		i++;
	}

	str2[i] = '\0';
}

int main() {
	/* 使用する変数の宣言 */
	char input_str[128];
	char dev_word_str[41][80];

	int deff;
	int deff_the = -1;
	int deff_that = -1;
	int deff_this = -1;
	int count_the = 0;
	int count_that = 0;
	int count_this = 0;
	int temp_deff;

	char temp[80];

	int word_sum;
	int letter_sum[40];

	int i, j, k;

	/* 入力を受け取る */
	while(fgets(input_str, 128, stdin) != NULL) {
		/* 各変数の初期化 */
		deff_the = -1;
		deff_that = -1;
		deff_this = -1;
		count_the = 0;
		count_that = 0;
		count_this = 0;

		/* 入力された文字列を単語ごとに分ける */
		i = 0; j = 0; k = 0;
		while(input_str[i]) {
			if(input_str[i] == ' ') {
				dev_word_str[j][k] = '\0';
				letter_sum[j] = k;
				j++;
				k = 0;
			}
			else if(input_str[i] == '.')
				dev_word_str[j][k] = '\0';
			else {
				dev_word_str[j][k] = input_str[i];
				k++;
			}

			i++;
		}

		word_sum = j + 1;

		/* 文字列を比較して、the, that, thisのいずれかがあるか調べる。 */
		for(i = 0; i < word_sum; i++) {
			str_cp(dev_word_str[i], temp);
			temp_deff = deff_two_char(temp[0], 't');
			shift_deff(temp_deff, temp);
			if(str_comp("the", temp)) {
				if(!count_the || deff_the != temp_deff) {
					deff_the = temp_deff;
					count_the++;
				}
			}
			else if(str_comp("that", temp)) {
				if(!count_that || deff_that != temp_deff) {
					deff_that = temp_deff;
					count_that++;
				}
			}
			else if(str_comp("this", temp)) {
				if(!count_this || deff_this != temp_deff) {
					deff_this = temp_deff;
					count_this++;
				}
			}
		}

		/* 比較の結果をもとに、実際いくつずれているか調べる。 */
		if(count_the == 1)
			deff = deff_the;
		else if(count_that == 1)
			deff = deff_that;
		else
			deff = deff_this;
		
		/* 出力 */
		i = 0;
		while(input_str[i] != '\n') {
			if(input_str[i] == ' ')
				putchar(' ');
			else if(input_str[i] == '.')
				putchar('.');
			else
				printf("%c", shift_letter_deff(deff, input_str[i]));
			i++;
		}

		putchar('\n');
	}

	return 0;
}

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

using namespace std;

void solve()
{
	string s;
	while(getline(cin, s))
	{
		for(int i = 0; i < 26; ++i)
		{
			for(int j = 0; j < s.size(); ++j)
			{
				if(s[j] >= 'a' && s[j] <= 'z')
				{
					if(s[j] == 'z')
					{
						s[j] = 'a';
					}
					else
					{
						++s[j];
					}
				}
			}
			unsigned int pos1 = s.find("this");
			unsigned int pos2 = s.find("the");
			unsigned int pos3 = s.find("that");
			if(pos1 != string::npos || pos2 != string::npos || pos3 != string::npos)
			{
				cout << s << endl;
			}
		}
	}
}

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

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

//メイン関数
int main()
{
  char str[81];
   while(fgets(str,sizeof(str),stdin)!=NULL){
  // while(scanf("%[^/n]s",str)!=EOF){

    //strstrで探索
  if((strstr(str,"the")) || (strstr(str,"this")) || (strstr(str,"that"))){
    puts(str);
    continue;
  }
  int len=strlen(str);
    for(int i=1;i<=26;i++){
      for(int j=0;j<len;j++){
	if(str[j]>='a' && str[j]<='z'){       
	  str[j]++;
	  if(str[j]=='{'){
	    str[j]='a';
	  }
	}
      }
      //strstrで探索
      if((strstr(str,"the")) || (strstr(str,"this")) || (strstr(str,"that")))break;
    }
    printf("%s\n",str);
  }
   return 0;
}