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

int main(){
  char cip[80][80];
  int words;
  int i, j;
  int gap;

  words=0;
  while(cin>>cip[words]) words++;

  for(i=0; i<words; i++){
    for(j=0; j<strlen(cip[i]); j++){
      if(cip[i][j]=='.') continue;
      cip[i][j]-='a';
    }
    if(strlen(cip[i])==3
       && (cip[i][1]-cip[i][0]+26)%26==14
       && (cip[i][2]-cip[i][0]+26)%26==11){
      gap=(cip[i][0]-('t'-'a')+26)%26;
      continue;
    }
    if(strlen(cip[i])>3
       && (cip[i][1]-cip[i][0]+26)%26==14
       && (cip[i][2]-cip[i][0]+26)%26==15
       && (cip[i][3]-cip[i][0]+26)%26==25){
      gap=(cip[i][0]-('t'-'a')+26)%26;
      continue;
    }
    if(strlen(cip[i])>3
       && (cip[i][1]-cip[i][0]+26)%26==14
       && (cip[i][2]-cip[i][0]+26)%26==7
       && (cip[i][3]-cip[i][0]+26)%26==0){
      gap=(cip[i][0]-('t'-'a')+26)%26;
      continue;
    }
  }
  for(i=0; i<words; i++){
    for(j=0; j<strlen(cip[i]); j++){
      if(cip[i][j]=='.') continue;
      cip[i][j]=(cip[i][j]-gap+26)%26+'a';
    }
    if(i==words-1) printf("%s\n", cip[i]);
    else printf("%s ", cip[i]);
  }

  return 0;
}

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

void shift(string &line){
  for ( int i = 0; i < line.size(); i++ ){
    if ( line[i] == 'z' ) line[i] = 'a';
    else if ( 'a' <= line[i] && line[i] <= 'y' ){
      line[i] = (line[i]-1);
    }
  }
}
int main(){
  string line;
  while(getline(cin,line)){
    if ( cin.eof() ) break;
    while(true){
      if (line.find("the") != string::npos ||
          line.find("this") != string::npos ||
          line.find("that") != string::npos) {
        cout << line << endl;
        break;
      }
      shift(line);
    }
  }
  return 0;
}

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

using namespace std;

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

C++: #include<iostream>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
int word_search(vector<string> s,  string key){
	for(int i = 0; i < s.size(); i++){
		if(s[i].length() <= 2 || s[i].length() >= 6) continue;
		for(int j = 0; j < s[i].length() - 1; j++)
			if(s[i][j] == '.') continue;
		if(s[i][s[i].length() - 1] == '.') s[i].erase(s[i].end() - 1);
		for(int j = 0; j < 26; j++){
			string turned_word;
			for(int k = 0; k < s[i].length(); k++){
				turned_word.push_back((s[i][k] + j - 'a') % 26 + 'a');
			}
			if(turned_word == key) return j;
		}
	}
	return -1;
}
int main(){
	for(;;){
		char line[200];
		if(fgets(line, sizeof(line), stdin) == NULL) break;
		vector<string> s;
		char *token = strtok(line, " ");
		s.push_back(token);
		for(;;){
			token = strtok(NULL, " ");
			if(token == NULL) break;
			s.push_back(token);
		}
		int num;
		if(word_search(s, "the") != -1) num = word_search(s, "the");
		if(word_search(s, "this") != -1) num = word_search(s, "this");
		if(word_search(s, "that") != -1) num = word_search(s, "that");
		for(int i = 0; i < s.size(); i++){
			for(int j = 0; j < s[i].length(); j++){
				if(s[i][j] == '.' || s[i][j] == '\n') cout << s[i][j];
				else cout << (char)((s[i][j] + num - 'a') % 26 + 'a');
			}
			if(i != s.size() - 1)cout << ' ';
		}
	}
	return 0;
}

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

using namespace std;

int main() {
    string s;
    int len;
    
    while (getline(cin, s)) {
        while (1) {
            len = s.size();
            for (int i = 0; i < len; i++) {
                if ('a' <= s[i] && s[i] <= 'z') {
                    if (s[i] == 'a') {
                        s[i] = 'z';
                    }
                    else {
                        s[i]--;
                    }
                }
            }
            int res1 = s.find("the");
            int res2 = s.find("this");
            int res3 = s.find("that");
            if ((res1 >= 0 && res1 < 80) || (res2 >= 0 && res2 < 80) || (res3 >= 0 && res3 < 80)) {
                cout << s << endl;
                break;
            }
        }
    }

    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

char ch;
string text;

int main() {
    while(getline(cin,text)){
    	for(int i=0;i<25;i++){
    		for(int j=0;j<text.size();j++){
    			if(text[j]>='a'&&text[j]<='y')text[j]+=1;
    			if(text[j]=='z')text[j]='a';
    		}
    		int p=text.find("the"),q=text.find("this"),r=text.find("that");
    		if(p!=string::npos||q!=string::npos||r!=string::npos){
    			cout<<text<<endl;
    			break;
    		}
    	}
    }
}

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

using namespace std;

int main()
{
	string S = "";

	getline(cin, S);

	for (int i = 0; i < 26; i++)
	{
		if (!(S.find("this") == S.npos && S.find("that") == S.npos && S.find("the") == S.npos))
		{
			cout << S;
		}

		for (string::size_type j = 0; j < S.size(); j++)
		{
			if (isalpha(static_cast<int>(S[j])))
			{
				if (S[j] == 'z')
				{
					S[j] = 'a';
				}
				else
				{
					S[j]++;
				}
			}
		}
	}

	return 0;
}

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

using namespace std;

int main(int argc, char **argv)
{
	char a[82], t;
	int n, p;
	
	while(gets(a)!=NULL){
		n = strlen(a);
		for(int i = 0; i < n; i++){
			p = (int)(a[i++]-'t');
			if(a[i] == ' '){
				continue;
			}
			t = a[i++]-p;
			if(t < 'a'){
				t += 25;
			} else if(t > 'z'){
				t -= 25;
			}
			if(a[i] == ' '){
				continue;
			}
			if(t == 'h'){
				t = a[i++]-p;
				if(t < 'a'){
					t += 25;
				} else if(t > 'z'){
					t -= 25;
				}
				if(t == 'e' && a[i] == ' '){
					break;
				} else if(t == 'i'){
					t = a[i++]-p;
					if(t < 'a'){
						t += 25;
					} else if(t > 'z'){
						t -= 25;
					}
					if(t == 's' && a[i] == ' '){
						break;
					}
				} else if(t == 'a'){
					t = a[i++]-p;
					if(t < 'a'){
						t += 25;
					} else if(t > 'z'){
						t -= 25;
					}
					if(t == 't' && a[i] == ' '){
						break;
					}
				}
			}
		}
		
		for(int i = 0; i < n; i++){
			if(a[i] == ' ' || a[i] == '.' || a[i] == ','){
				printf("%c",a[i]);
			} else {
				t = a[i]-p;
				if(t < 'a'){
					t += 25;
				} else if(t > 'z'){
					t -= 25;
				}
				printf("%c",t);
			}
		}
		cout << endl;
	}
	
	return 0;
}