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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int main(){
	char input[100],str[50][100];
	const char cmp[3][5]={"that","this","the"};
	int pos=0,last_pos=0,i,j,k,diff,n;
	bool flag;

		fgets(input,100,stdin);
		for(i=0;input[i]!='\0';i++){
			if(input[i]==' ' || input[i]=='.' || input[i]=='\n'){
				for(j=last_pos;j<i;j++){
					str[pos][j-last_pos]=input[j];
				}
				str[pos][j-last_pos]='\0';
				pos++;
				last_pos=i+1;
			}
		}

		n=0;
		flag=false;
		while(++n){
			for(i=0;i<pos;i++){
				for(j=0;str[i][j]!='\0';j++){
					str[i][j]+=1;
					if('a'>str[i][j]){
						str[i][j]+='z'-'a'+1;
					}else if('z'<str[i][j]){
						str[i][j]+='a'-'z'-1;
					}
				}
			}

			for(i=0;i<pos;i++){
				for(j=0;j<3;j++){
					if(strcmp(str[i],cmp[j])==0){
						flag=true;
                        j=3;i=pos;
					}
				}
			}
			if(flag) break;
		}

		int temp;
		for(i=0;input[i]!='\n';i++){
			if(input[i]!='.' && input[i]!=' '){
				temp=input[i]+n;
				if('a'>temp){
					input[i]=temp+'z'-'a'+1;
				}else if('z'<temp){
					input[i]=temp+'a'-'z'-1;
				}else{
					input[i]=temp;
				}
			}
		}
		printf("%s",input);

	return 0;
}

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

using namespace std;

string slide(string s) {
  string r = s;
  for (int i = 0; i < r.length(); i++) {
    if (islower(r[i])) {
      if (r[i] == 'z') r[i] = 'a';
      else r[i] += 1;
    }
  }
  return r;
}

bool check_word(string s) {
  string dic[3] = {"this", "the", "that"};
  stringstream ss;
  string word;
  ss << s;
  for (int i = 0; i < 3; i++) {
    ss >> word;
    if (dic[i] == word) return true;
  }
  return false;
}

int main() {
  string in, temp;
  bool found;
  while (!cin.eof()) {
    getline(cin, in);
    for (temp = in, found = false; ; temp = slide(temp)) {
      found = check_word(temp);
      if (found) break;
    }
    cout << temp << endl;
  }
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <ctype.h>

using namespace std;

inline char rotate(char c, int x){
    int r = x % 26;
    if(isalpha(c)){
        c += r;
    }

    return c;
}

inline char decode_from_t(char t, char tgt){
    int df = ('t' - t) % 26;
    tgt += df;
    return tgt;
}

char buf[82];
enum state {
    init,
    wait_h,
    after_th,
    rest_chars,
    wait_sep,
    other_word,
};

inline bool is_sep(char *c){
    return *c == '.' || *c == ' ';
}

// return diff.
int findTheThatThis(){
    state s = init;
    char *c = buf;
    char next, dec, t;

    while(*c != '\n'){
        switch (s) {
            case init:
                if(isalpha(*c)){
                    s = wait_h;
                    t = *c;
                }
                break;
            case wait_h:
                if(is_sep(c)){
                    s = init;
                }else{
                    dec = decode_from_t(t, *c);
                    if(dec == 'h'){
                        s = after_th;
                    }else{
                        s = other_word;
                    }
                }
                break;
            case after_th:
                if(is_sep(c)){
                    s = init;
                }else {
                    dec = decode_from_t(t, *c);
                    switch (dec) {
                        case 'e':
                            s = wait_sep;
                            break;
                        case 'i':
                            next = 's';
                            s = rest_chars;
                            break;
                        case 'a':
                            next = 't';
                            s = rest_chars;
                            break;
                        default:
                            s = other_word;
                            break;
                    }
                }
                break;
            case rest_chars:
                if(is_sep(c)){
                    s = init;
                }else{
                    dec = decode_from_t(t, *c);
                    if(dec == next){
                        s = wait_sep;
                    }else{
                        s = other_word;
                    }
                }
                break;
            case wait_sep:
                if(is_sep(c)){
                    return 't' - t;
                }else{
                    s = other_word;
                }
                break;
            case other_word:
                if(is_sep(c)){
                    s = init;
                }
                break;
        } // end switch
        c++;
    } // end while
    // not found
    return -1;
}

int main(int argc, char const* argv[])
{
    int dif;

    while (nullptr != fgets(buf, 82, stdin)) {
        dif = findTheThatThis();
        for (int i = 0; ; i++) {
            if(buf[i] == '\n'){
                buf[i] = '\0';
                puts(buf);
                break;
            }
            buf[i] = rotate(buf[i], dif);
        }
    }

        return 0;
}

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

int caesar[26][255], x, enkrip[100];
int thiss[] = {'t', 'h', 'i', 's'}, the[] = {'t', 'h', 'e'}, that[] = {'t', 'h', 'a', 't'};
string s;
int main() {
	for(int i = 0; i <= 25; i++) {
		for(char j = 'a'; j <= 'z'; j++) {
			if(j + i > 'z') x = j + i - 26; else x = j + i;
			caesar[i][x] = j;
		}
	}
	while(getline(cin, s)) {
	for(int k = 0; k <= 25; k++) {
		int l = 0, z = 0, zz = 0;
		for(int i = 0, j = s.size(); i != j; i++) {
			if(s[i] <= 'z' && s[i] >= 'a') {
				enkrip[i] = caesar[k][s[i]];
				if(enkrip[i] == thiss[l]) l++;
				if(enkrip[i] == the[z]) z++;
				if(enkrip[i] == that[zz]) zz++;
			} else {enkrip[i] = s[i]; if(l != 4) l = 0; if(z != 3) z = 0;if(zz != 4) zz = 0; }
		}
		if(l >= 4 || z >= 3 || zz >= 4) {
			for(int i = 0, j = s.size(); i != j; i++) {
				printf("%c", enkrip[i]);
			}
			printf("\n");
			break;
		}
	}}
	return 0;
}

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

int main(){
	std::string str;
	std::getline(std::cin,str);
	while(true){
		for(int j=0;j<str.size();j++){
			if(str[j]!=' '&&str[j]!='.'){
				int a=static_cast<int>(str[j]);
				a-=2;
				while(a<(int)'a')a+=26;
				while(a>(int)'z')a-=26;
				str[j]=static_cast<char>(a);
			}
		}
		if(str.find("the")!=-1||str.find("this")!=-1||str.find("that")!=-1)break;
	}
	std::cout<<str<<std::endl;
	return 0;
}

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

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