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<string>
using namespace std;
int main(){
  int ans=-1,len=0;
  string s;
  getline(cin,s);
  while(len<27){
    ans = s.find("the");
    if(ans!=-1)break;
    ans = s.find("this");
    if(ans!=-1)break;
    ans = s.find("that");
    if(ans!=-1)break;
    for(int i=0;i<s.size();i++){
      if(s[i]=='z') s[i]='a';
      else if(s[i]>='a' && s[i]<'z') s[i]++;
    }
    len++;
  }
  cout << s << endl;
}

C++: #include<cstdio>
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
string cea (string a){
  for(int i=0;i<a.length();i++){
    if(a[i]=='.'){}
    else a[i]=(char)a[i]+1;
    if(a[i]=='{')a[i]='a';
  }
    return a;
}

string cear(string b,int c){
  for(int i=0;i<c;i++){
    b=cea(b);
  }
  return b;
}


int main(){
  string input[100];
  string in;
  int n=0;
  int ans=0;
  while(cin>>in){
    if(in=="00")break;
    input[n]=in;
    n++;
    
  }
  for(int i=0;i<30;i++){
    for(int j=0;j<n;j++){
      in=cear(input[j],i);
      if(in=="the"||in=="this"||in=="that"){ans=i;}
    }
  }
  for(int i=0;i<n-1;i++){
    cout<<cear(input[i],ans)<<' ';
  }
  cout<<cear(input[n-1],ans)<<endl;
  cout<<ans<<endl;

}

C++: #include <iostream>
#include <cstdlib>
#include <string>
#include <cctype>
#include <algorithm>
using namespace std;

char cShiftchar(char ch)
{
    if(isalpha(ch))
    {
        ch++;
        if(ch > 'z') ch = ch - 'z' + 'a' -1;
    }

    return ch;
}

string sDecode(string str)
{
    string ans;
    while( str.find("the")
            && str.find("this")
            && str.find("that")
         )
    {
        transform(str.begin(), str.end(), str.begin(), cShiftchar);

    }
    return str;
}

int main()
{
    string str;
    while(getline(cin, str))
    {
        cout << sDecode(str) << endl;
    }
    return EXIT_SUCCESS;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const string w[] = { "the", "this", "that" };

string decoded_letter (string s, int m )
{
	int n = s.length();
	rep (i, n ){
		if (s[i] == ' ' || s[i] == ',' || s[i] == '.' ) continue;
		s[i] = (char)(((int)(s[i] - 'a') + m ) % 26 + 'a');
	} // end rep

	return s; 
}

bool is_include (string s )
{
	int n = s.length();
	rep (i, n ){
		if (s[i] == ',' || s[i] == '.' ) s[i] = ' ';
	} // end rep

	stringstream ss (s );
	string t = "";
	while (ss >> t ){
		rep (i, sizeof (w )/sizeof (w[0] ) ){
			if (t == w[i] ){
				return true;
			} // end if
		} // end rep
	} // end while

	return false;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.CC", "r", stdin );
	string str = "";
	while (getline (cin, str ) ){
		string decode = "";
		rep (i, 26 ){	// secret number
			decode = decoded_letter (str, i );
			if (is_include (decode ) ){
				break;
			} // end if
		} // end rep
		cout << decode << endl;		
	} // end loop
		
	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++;
			if (nSlide >= 26)
				break;
		}
	}

	if (nSlide >= 26)
		printf("This Not Found");
	else
		printf("%s", PhraseOut);

	return 0;
}

bool Check(char* Str)
{
	int nCnt = 0;
	int nCnt2 = 0;

	while (Str[nCnt] != '\0')
	{
		char Work[80] = "\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<stdio.h>
#include<string.h>


void Roll(char ch[], int times) {
	int cnt = 0;
	while (ch[cnt] != 0) {
		if (96 < ch[cnt] && 123 > ch[cnt])
			ch[cnt] = (ch[cnt] - 97 + times) % 26 + 97;
		cnt++;
	}
}

int main() {
	char inp[100]; char buff[80];

	int pos = 0, bpos = 0;

	while (1) {
		if (gets_s(inp, 100) == NULL)break;
		while (1) {
			if (96 < inp[pos] && 123 > inp[pos]) {
				buff[bpos] = inp[pos];
				bpos++; pos++;
			}
			else {
				buff[bpos] = '\0';
				if (strlen(buff) != 3 && strlen(buff) != 4) {
					bpos = 0;
					continue;
				}
				Roll(buff, 116 - inp[0]);
				if (strcmp(buff, "this") == 0 || strcmp(buff, "that") == 0 || strcmp(buff, "the") == 0) {
					Roll(inp, 116 - inp[0]);
					break;
				}
				else {
					bpos = 0;
					continue;
				}

			}
		}
		puts(inp);
	}
	return 0;
}