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>
using namespace std;

string decy(string s,int k) {
    string res = "";
    for(int i=0; i<s.length(); ++i) {
        if(s[i] >= 'a' && s[i] <= 'z') res += string(1,(s[i]-'a'+k)%26+'a');
        else res += string(1, s[i]);
    }
    return res;
}

bool isvalid(string s) {
    if(s.find("this") != string::npos || s.find("that") != string::npos
       || s.find("the") != string::npos) return true;
    return false;
}

int main() {
    string s;
    while(getline(cin,s)) {
        for(int i=0; i<=25; ++i) {
            s = decy(s,1);
            if(isvalid(s)) {
                cout<<s<<endl;
                break;
            }
        }
    }
}

C++: #include<stdio.h>

int main()
{
    char a;
    while(scanf("%c",&a)==1)
    {
if (a =='a')
    printf("w");
if (a=='b')
    printf("x");
if (a=='c')
    printf("y");
if (a=='d')
    printf("z");
if (a=='e')
    printf("a");
if (a=='f')
    printf("b");
if (a=='g')
    printf("c");
if (a=='h')
    printf("d");
if (a=='i')
    printf("e");
if (a=='j')
    printf("f");
if (a=='k')
    printf("g");
if (a=='l')
    printf("h");
if (a=='m')
    printf("i");
if (a=='n')
    printf("j");
if (a=='o')
    printf("k");
if (a=='p')
    printf("l");
if (a=='q')
    printf("m");
if (a=='r')
    printf("n");
if (a=='s')
    printf("o");
if (a=='t')
    printf("p");
if (a=='u')
    printf("q");
if (a=='v')
    printf("r");
if (a=='w')
    printf("s");
if (a=='x')
    printf("t");
if (a=='y')
    printf("u");
if (a=='z')
    printf("v");
if (a==' ')
    printf(" ");
if (a=='\n')
    printf("\n");
if (a=='.')
    printf(".");
if (a==',')
    printf(",");
if (a=='!')
    printf("!");
if (a=='/')
    printf("/");
    if (a=='?')
    printf("?");
    if (a==':')
    printf(":");
    if (a==':')
    printf(":");
    if (a=='@')
    printf("@");
    if (a=='1')
    printf("1");
    if (a=='2')
    printf("2");
    if (a=='3')
    printf("3");
    if (a=='4')
    printf("4");
    if (a=='5')
    printf("5");
    if (a=='6')
    printf("6");
    if (a=='7')
    printf("7");
    if (a=='8')
    printf("8");
    if (a=='9')
    printf("9");
    if (a=='0')
    printf("0");
    if (a=='=')
    printf("=");
    if (a=='+')
    printf("+");
    if (a=='-')
    printf("-");
    if (a=='_')
    printf("_");
    }
    return 0;
}

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

int main(){
	string str;
	while(getline(cin, str)){
		while(str.find("this", 0) == string::npos || str.find("that", 0) == string::npos){
			for(int i = 0; i < str.size(); ++i){
				if(str[i] >= 'a' && str[i] <= 'z'){
					if(str[i] != 'z')
						++str[i];
					else
						str[i] = 'a';
				}
			}
		}
		cout << str << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	string n;
	while(getline(cin,n)){
		string tmp=n;
		for(int i=0;i<26;i++){
			if(tmp.find("the")!=-1||tmp.find("that")!=-1||tmp.find("this")!=-1)break;
			for(int j=0;j<tmp.size();j++){
				if(tmp[j]==' '||tmp[j]=='.')continue;
				if(tmp[j]=='z')tmp[j]='a';
				else tmp[j]++;
			}
		}
		cout<<tmp<<endl;
	}
	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("%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 <string>
#include <iostream>

bool NotMatch( const std::string& str )
{
	return str.find("the") == std::string::npos && str.find("this") == std::string::npos && str.find("that") == std::string::npos;
}

int main()
{
	std::string str;
	while( getline(std::cin,str) )
	{
		while( NotMatch(str) )
		{
			for( unsigned i=0; i<str.length(); ++i )
			{
				if( str[i]=='.' || str[i]==' ' || str[i]=='\n' )
				{
					continue;
				}

				if( str[i] == 'z' )
				{
					str[i] = 'a';
				}
				else
				{
					--str[i];
				}
			}
		}

		std::cout << str << '\n';
	}
}