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>
#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;
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#define N 100
using namespace std;

void hukugou(char str2[]){
  int i;

  while(1){

    for(i = 0;str2[i] != '\0';i++){
      if(str2[i] != ' ' && str2[i] != '\n'){
	str2[i] = (str2[i] - 'a' + 1) % 26 + 'a';
      }
    }

    if(strstr(str2, "the") != NULL || strstr(str2, "this") != NULL || strstr(str2, "that") != NULL){
      cout << str2;
      break;
    }
  }

}

int main(){
  char str[N];

  fgets(str, sizeof(str), stdin);

  hukugou(str);

  return 0;
}

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