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 <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
 
int main() {
    string s;
    while(getline(cin, s)){
    	rep(i, 26) {
	    	rep(j, s.size()) {
	            if(97 <= s[i] && s[i] <= 122) s[j] = s[j] + 'a';
	            else s[j] = 'a';
	        }
	        if(s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos){
                cout << s << endl;
            }
	    }
    }
    return 0;
}

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

using namespace std;

string dict = "abcdefghijklmnopqrstuvxwyz";

string decode(string s, int v) {
    string ans = s;
    for(int i = 0; i < (int) s.size(); i++) {
        if(s[i] >= 'a' && s[i] <= 'z') {
            ans[i] =  dict[((s[i] + v) % 26)];
        }
    }
    return ans;
}

int main() {
    string s;

    while(getline(cin, s)) {
        for(int i = 1; i < 26; i++) {
            string tmp = decode(s, i);
            if(tmp.find("this") != string::npos && tmp.find("the") != string::npos && tmp.find("that") != string::npos) {
                cout << tmp << endl;
                break;
            }
         }
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
	char t[27][27] = {"bcdefghijklmnopqrstuvwxyza", "cdefghijklmnopqrstuvwxyzab", "defghijklmnopqrstuvwxyzabc",
		"efghijklmnopqrstuvwxyzabcd", "fghijklmnopqrstuvwxyzabcde", "ghijklmnopqrstuvwxyzabcdef",
		"hijklmnopqrstuvwxyzabcdefg", "ijklmnopqrstuvwxyzabcdefgh", "jklmnopqrstuvwxyzabcdefghi",
		"klmnopqrstuvwxyzabcdefghij", "lmnopqrstuvwxyzabcdefghijk", "mnopqrstuvwxyzabcdefghijkl",
		"nopqrstuvwxyzabcdefghijklm", "opqrstuvwxyzabcdefghijklmn", "pqrstuvwxyzabcdefghijklmno",
		"qrstuvwxyzabcdefghijklmnop", "rstuvwxyzabcdefghijklmnopq", "stuvwxyzabcdefghijklmnopqr",
		"tuvwxyzabcdefghijklmnopqrs", "uvwxyzabcdefghijklmnopqrst", "vwxyzabcdefghijklmnopqrstu",
		"wxyzabcdefghijklmnopqrstuv", "xyzabcdefghijklmnopqrstuvw", "yzabcdefghijklmnopqrstuvwx",
		"zabcdefghijklmnopqrstuvwxy"};
	char s[81], r[81];
	string u;
	int i, j;
	while (1)
	{
		cin.getline(s, sizeof(s));
		if (cin.eof()) break;
		for (i = 0; i < 27; i++)
		{
			for (j = 0; j < strlen(s); j++)
			{
				if ('a' <= s[j] && s[j] <= 'z')
					r[j] = t[i][(int)(s[j]-'a')];
				else
					r[j] = s[j];
			}
			r[strlen(s)] = '\0';
			u = r;
			if (u.find("the") != string::npos && u.find("this") != string::npos && u.find("that") != string::npos)
			{
				cout << u << endl;
				break;
			}
		}
	}
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 1000000000;
using namespace std;
int main() {
  string n;
  while (getline(cin, n)) {
    string ans = n;
    for (int i = 0; i < 26; i++) {
      if (ans.find("the") != -1 || ans.find("that") != -1 ||
          ans.find("this") != -1)
        break;
      for (int j = 0; j < ans.size(); j++) {
        if (ans[j] == ' ' || ans[j] == '.')
          continue;
        if (ans[j] == 'z')
          ans[j] = 'a';
        else
          ans[j]++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

string Caesar(string str, int shift){
    string ret="";
    REP(i, str.size()){
        if('a'<=str[i] && str[i]<='z') ret += (str[i] - 'a' + shift) % 26 + 'a';
        else ret+=str[i];
    }
    return ret;
}

int main(){
	string str;
	while(getline(cin, str, '\n')){
		REP(i, 26){
			string fix = Caesar(str, i);
	    	if( fix.find( "the", 0 ) != string::npos ||
	    		fix.find( "this", 0 ) != string::npos ||
	    		fix.find( "that", 0 ) != string::npos ){
				cout<<fix<<endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
  char a[81];
  cin.getline(a,81);
  while(1){
    for(int i=0;i<strlen(a);i++){
      if(a[i]==' '||a[i]=='.') continue;
      else if(a[i]=='z') a[i] = 'a';
      else a[i] = a[i]-'a'+'b';
    }
    for(int i=0;i<strlen(a)-3;i++){
      if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='i'&&a[i+3]=='s') goto END;
      if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='a'&&a[i+3]=='t') goto END;
      if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='e') goto END;
    }
  }
 END:
  for(int i=0;i<strlen(a);i++) cout << a[i];
  cout << endl;
  return 0;
}

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>
#include <cmath>
#include <cstdio>
#include <vector>

using namespace std;
char encrypt[50];
char decrypt[50];
int key,i;

int main(){
    scanf("%[^\r\n]", encrypt);
    while(encrypt[i] != '\0'){
        if((i != 0 && encrypt[i-1] == ' ' && encrypt[i] - encrypt[i+1] == 12) || encrypt[i] - encrypt[i+1] == 12){
            key = 't' - encrypt[i];
            break;
        }
        i++;
    }

    i = 0;
    while(encrypt[i] != '\0'){
        if(encrypt[i] <= 'z' && encrypt[i] >= 'a'){
            decrypt[i] = (encrypt[i] - 'a' + key) % 26 + 'a';
        }
        else{
            decrypt[i] = encrypt[i];
        }
        i++;
    }
    printf("%s\n", decrypt);
    return 0;
}