Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		var result string
		line := scanner.Text()
		key := make(map[string]string)

		var i int32
		for ; i < 52; i++ {
			makeKey(key, i)
			result = decode(key, line)

			if strings.Contains(result, "the") {
				break
			} else if strings.Contains(result, "this") {
				break
			} else if strings.Contains(result, "that") {
				break
			}
		}

		fmt.Println(result)
	}
}

func makeKey(key map[string]string, shift int32) {
	for i := 'a'; i <= 'z'; i++ {
		cipher := (i + shift)
		if cipher > 'z' {
			cipher = cipher%'z' + 'a' - 1
		} else if cipher < 'a' {
			cipher = cipher + ('z' - 'a') + 1
		}
		key[string(i)] = string(cipher)
	}
}

func decode(key map[string]string, cipher string) string {
	var result string
	for _, v := range cipher {
		if key[string(v)] != "" {
			result += key[string(v)]
		} else {
			result += string(v)
		}
	}
	return result
}

C++: #include <stdio.h>
#include <string.h>

static char *words[] = {
  "the",
  "this",
  "that"
};

int main(void)
{
  char cipher[80];
  while(scanf("%[^\n]%*c", cipher) != EOF){

    int i,j,k,l;
    for(i=0; i<26; ++i){

      for(j=0; j<strlen(cipher); ++j){
        if('a'<=cipher[j] && cipher[j]<='z'){
          cipher[j] = (cipher[j]-'a'+1)%26+'a';
        }
      }
      
      int hit = 0;
      for(j=0; !hit && j<(sizeof words/sizeof words[0]); ++j){
        for(k=0; !hit && k+strlen(words[j])<=strlen(cipher); ++k){
          for(l=0; l<strlen(words[j]); ++l){
            if(cipher[k+l]==words[j][l]){
              hit = 1;
            }else{
              hit = 0;
              break;
            }
          }
        }
      }

      if(hit){
        printf("%s\n", cipher);
        break;
      }
    }
  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <regex>
#include <cctype>
using namespace std;

vector<string> v;

vector<string> split(string&& s, regex&& pattern) {
    sregex_token_iterator first(s.begin(), s.end(), pattern, -1);
    sregex_token_iterator last;
    return(vector<string>(first, last));
}

bool cheser() {
    for(int r = 1; r <= 50; r++) {
        bool found = false;
        for(int c = 0; c < v.size(); c++) {
            for(int k = 0; k < v[c].length(); k++) {
                if(!isalpha(v[c][k])) continue;
                int now = v[c][k] - 'a';
                now = (now+1)%26;
                v[c][k] = 'a' + now;
            }
            if(v[c] == "the" || v[c] == "this" || v[c] == "that") found = true;
        }
        if(found) return(true);
    }
    return(false);
}

int main(void) {
    string input;
    while(getline(cin, input)) {
        v = split(move(input), regex(" "));
        cheser();
        for(int r = 0; r < v.size(); r++) {
            cout << v[r];
            if(r == v.size() - 1) cout << endl;
            else                  cout << " ";
        }
    }
    
    return(0);
}

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

using namespace std;

void Shift(string *str, int shift, int vec) {
  for (int str_i = 0; str_i < str->size(); str_i++)
    if (!isspace((*str)[str_i]) && (*str)[str_i] != '.')
      (*str)[str_i] += vec * shift;
}

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

int main() { 
  string input_str;

  int shift = 1;
  while (getline(cin, input_str)) {
    while (1) {
      Shift(&input_str, shift, 1);
      if (FindTarget(input_str))
        break;
      Shift(&input_str, shift, -1);
      Shift(&input_str, shift, -1);
      if (FindTarget(input_str))
        break;
      Shift(&input_str, shift, 1);
      shift++;
    }
    cout << input_str << endl;
  }

  return 0;
}

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

using namespace std;

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

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

const int msg_size = 80;
const char int2alp[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'
};

typedef map<char, int> myMap;
myMap alp2int;

int get_length(char *data) {
	for (int i = 0;; i++) {
		if (data[i] == '\0') {
			return i;
		}
	}
}

bool is_match(char *data) {
	for (int i = 0; i < 81; i++) {
		if (data[i] == 't' && data[i+1] == 'h') {
			if (data[i+2] == 'e') {
				return true;
			}
			else if (data[i+2] == 'i' && data[i+3] == 's'){
				return true;
			}
			else if (data[i+2] == 'a' && data[i+3] == 't') {
				return true;
			}
		}
	}
	return false;
}

bool gen_caesar(char *data, int size, int length) {
	char prev[100], back[100];
	prev[length] = back[length] ='\0';
	for (int i = 0; i < length; i++) {
		if (data[i] == ' ' || data[i] == '.' || data[i] == '\n') {
			prev[i] = data[i];
			back[i] = data[i];
		}
		else {
			prev[i] = int2alp[(alp2int[data[i]]+size) % 26];
			back[i] = int2alp[(alp2int[data[i]] >= size) ? alp2int[data[i]]-size : 26-(size-alp2int[data[i]])];
		}
	}
	if (is_match(prev)) {
		printf("%s", prev);
		return true;
	}
	if (is_match(back)) {
		printf("%s", back);
		return true;
	}
	return false;
}

void init_alp2int() {
	alp2int.insert(myMap::value_type('a', 0));
	alp2int.insert(myMap::value_type('b', 1));
	alp2int.insert(myMap::value_type('c', 2));
	alp2int.insert(myMap::value_type('d', 3));
	alp2int.insert(myMap::value_type('e', 4));
	alp2int.insert(myMap::value_type('f', 5));
	alp2int.insert(myMap::value_type('g', 6));
	alp2int.insert(myMap::value_type('h', 7));
	alp2int.insert(myMap::value_type('i', 8));
	alp2int.insert(myMap::value_type('j', 9));
	alp2int.insert(myMap::value_type('k', 10));
	alp2int.insert(myMap::value_type('l', 11));
	alp2int.insert(myMap::value_type('m', 12));
	alp2int.insert(myMap::value_type('n', 13));
	alp2int.insert(myMap::value_type('o', 14));
	alp2int.insert(myMap::value_type('p', 15));
	alp2int.insert(myMap::value_type('q', 16));
	alp2int.insert(myMap::value_type('r', 17));
	alp2int.insert(myMap::value_type('s', 18));
	alp2int.insert(myMap::value_type('t', 19));
	alp2int.insert(myMap::value_type('u', 20));
	alp2int.insert(myMap::value_type('v', 21));
	alp2int.insert(myMap::value_type('w', 22));
	alp2int.insert(myMap::value_type('x', 23));
	alp2int.insert(myMap::value_type('y', 24));
	alp2int.insert(myMap::value_type('z', 25));
}

int main(int argc, char *argv[]) {
	init_alp2int();
	char rcv[100];
	
	while(NULL != fgets(rcv, 80, stdin)) {
		int length = get_length(rcv);
	
		for (int i = 0; i < 26; i++) {
			if (gen_caesar(rcv, i, length)) {
				break;
			}
		}
	}
	return 0;
}