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 <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;

vector<string> aa;

int main()
{
	string a;

	getline(cin, a);
	auto left = a.begin();
	
	while (true){
		auto right = left;
		while (right != a.end() && *right != ' ')++right;

		aa.emplace_back(left,right);
		if (right == a.end())
			break;

		left = right+1;
	}
	

	string c[3] = { "this", "that" , "the"};

	vector<string> nn;
	vector<string> kk;
	for (auto x : aa){
		auto n = x.length();
		if (n == 3){
			kk.push_back(x);
		}
		if (n == 4){
			nn.push_back(x);
		}
	}

	for (auto x : kk){
		auto n1 = x[0] - c[2][0];
		bool f(true);

		for (int i = 1; i < 3; ++i){
			if (n1 != x[i] - c[2][i])
				f = false;
		}

		if (f){
			int i(0);
			for (auto x : aa){
				for (auto y : x){
				
					if ('a' > y || 'z' < y){
						std::cout << y;
						continue;
					}

					int q = y - 'a';
					if (q - n1 < 0){
						q = 26 - n1;
					}
					else
						q -= n1;

					std::cout << (char)(q + 'a');
				}
				if (i < aa.size() - 1)
					std::cout << " ";
				++i;
			}
			std::cout << endl;
			return 0;
		}
	}

	for (auto x : nn){
		auto n1 = x[0] - c[0][0];
		auto n2 = x[0] - c[1][0];
		bool f(true);
		bool f2(true);

		for (int i = 1; i < 4; ++i){
			if (n1 != x[i] - c[0][i])
				f = false;
			if (n2 != x[i] - c[1][i])
				f2 = false;
		}

		if (f){
			int i(0);
			for(auto x : aa){
				for (auto y : x){
					if ('a' > y || 'z' < y){
						std::cout << y;
						continue;
					}

					int q = y - 'a';
					if (q - n1 < 0){
						q = 26 - n1;
					}
					else
						q -= n1;

					std::cout << (char)(q + 'a');
				}
				if (i < aa.size()-1)
					std::cout << " ";
				++i;
			}
			std::cout << endl;
			return 0;
		}
		else if (f2){
			int i(0);
			for (auto x : aa){
				for (auto y : x){
					if ('a' > y || 'z' < y){
						std::cout << y;
						continue;
					}

					int q = y - 'a';
					if (q - n2 < 0){
						q = 26 - n2;
					}
					else
						q -= n2;

					std::cout << (char)(q + 'a');
				}
				if (i < aa.size() - 1)
					std::cout << " ";
				++i;
			}
			std::cout << endl;
			return 0;
		}

	}
	return 0;
}

C++: #include <cctype>
#include <cstdio>

using namespace std;

int k = 0;

char enc(char c) {
  return (c-'a'+k)%26+'a';
}

char dec(char c) {
  if (!islower(c))
    return c;
  return (c-'a'+26-k)%26+'a';
}

int main() {
  char s[128];
  while (fgets(s, 128, stdin)) {
    char *c = s;
state_delim:
    switch (*c) {
    case '.':
    case ' ':
      *c++;
      goto state_delim;
    case '\n':
      goto decode;
    default:
      goto state_start;
    }
state_start:
    if (islower(*c)) {
      k = (*c-'t'+26)%26;
      goto state_t;
    }
    goto state_delim;
state_t:
    *c++;
    if (islower(*c)) {
      if (*c == enc('h'))
        goto state_h;
      goto state_word;
    }
    goto state_delim;
state_h:
    *c++;
    if (islower(*c)) {
      if (*c == enc('e'))
        goto state_accept;
      if (*c == enc('i'))
        goto state_i;
      if (*c == enc('a'))
        goto state_a;
      goto state_word;
    }
    goto state_delim;
state_i:
    *c++;
    if (islower(*c)) {
      if (*c == enc('s'))
        goto state_accept;
      goto state_word;
    }
    goto state_delim;
state_a:
    *c++;
    if (islower(*c)) {
      if (*c == enc('t'))
        goto state_accept;
      goto state_word;
    }
    goto state_delim;
state_word:
    *c++;
    if (islower(*c))
      goto state_word;
    goto state_delim;
state_accept:
    *c++;
    if (!islower(*c))
      goto decode;
    goto state_word;
decode:
    c = s;
    while (*c)
      printf("%c", dec(*c++));
  }
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	string a = "";
	while (getline(cin, a)) {
		a += " ";
		string b = "";
		int z = 0, sum = 0;
		int k = a.length();
		for (int i = 0; i <k; i++) {
			if (a[i] == ' ' || a[i] == '.') {
				b = a.substr(z, i - z);
				int t = (int)'t';
				string c = "";
				if (b.length() == 3 || b.length() == 4) {
					c = "";
					int w = t - (int)b[0];
					for (int i = 0; i < b.length(); i++) {
						int d = (char)((int)b[i] + w);
						if (d > 'z')
							d -= 26;
						else if (d < 'a')
							d += 26;
						c += (char)d;
					}
					if (c == "the" || c == "that" || c == "this") {
						sum = w;
						break;
					}
				}
				z = i + 1;
			}
		}
		string f = "";

		for (int i = 0; i < k-1; i++) {
			if (a[i] != ' ' && a[i] != '.' ) {
				int g = (int)a[i] + sum;
				if (g >(int)'z')
					g -= 26;
				else if (g < (int)'a')
					g += 26;
				f += (char)g;
			}
			else {
				f += a[i];
			}
		}
		cout << f << endl;
	}
}

C++: #include <cstdio>
#include <string.h>
using namespace std;

char str[128] = { 0 };

inline char nxt(char c) {
	if (c == 'z') {
		c = 'a';
	}
	else if (c >= 'a' && c < 'z') {
		c++;
	}
	return c;
}

bool find() {
	int p = 0;
	while (str[p] != '\0') {
		if (str[p] == 't' && str[p + 1] == 'h') {
			if (str[p + 2] == 'e') {
				return true;
			}
			else if (str[p + 2] == 'i' && str[p + 3] == 's') {
				return true;
			}
			else if (str[p + 2] == 'a' && str[p + 3] == 't') {
				return true;
			}
		}
		p++;
	}
	return false;
}

int main(){
	while (fgets(str, sizeof(str), stdin) != NULL) {
		str[strlen(str) - 1] = '\0';
		for (int i = 0; i < 25; i++) {
			int p = 0;
			while (str[p] != '\0') {
				str[p] = nxt(str[p]);
				p++;
			}
			if (find()) {
				printf("%s", str);
				break;
			}
		}
	}


	return 0;
}

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

int main(){
	string str;
	while(1){
		getline( cin, str );
		if( str.length()==0 )	break;
		for( int i=0; i<=26; i++ ){
			for( int j=0; j<str.length(); j++ ){
				if( 'a'<=str[j] && str[j]<='z' ){
					str[j]++;
					if( str[j] == 'z'+1 )
						str[j] = 'a';
				}
			}
			if( str.find("the")+str.find("this")+str.find("that") != -3 ){
				cout << str << endl;
				break;
			}
		}
	}
	return 0;
}