Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

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 {
		infos := strings.Split(nextString(), " ")
		plain := make([]string, len(infos))
		if len(infos) == 0 {
			break
		}
		// 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<vector>
#include<string>
int main()
{
	std::vector<std::string>result;
	for (std::string str; std::getline(std::cin, str);)
	{
		char delta;
		for (int i = 0;; i++)
		{
			if (str[i] != ' ' && str[i] != '.' && str[i + 1] != ' ' && str[i + 1] != '.' && str[i + 2] != ' ' && str[i + 2] != '.')
			{
				int d1, d2, d3;
				d1 = (int)(str[i] - str[i + 1]);
				if (d1 < 0)
				{
					d1 += 26;
				}
				d2 = (int)(str[i + 1] - str[i + 2]);
				if (d2 < 0)
				{
					d2 += 26;
				}
				if (d1 == 't' - 'h')
				{
					if (d2 == 'h' - 'e')
					{
						delta = str[i] - 't';
						break;
					}
					else
					{
						if (str[i + 3] != ' ' && str[i + 3] != '.')
						{
							d3 = (int)(str[i + 2] - str[i + 3]);
							if (d3 > 0)
							{
								d3 -= 26;
							}
							if (d2 == 'h' - 'i' && d3 == 'i' - 's' || d2 == 'h' - 'a' && d3 == 'a' - 't')
							{
								delta = str[i] - 't';
								break;
							}
						}
					}
				}
			}
		}
		result.push_back(std::string(str.length(), '0'));
		for (int i = 0; i < str.length(); i++)
		{
			result.back()[i] = str[i] != ' ' && str[i] != '.' ? (str[i] - delta - 'a') % 26 + 'a' : str[i];
		}
	}
	for (auto i : result)
	{
		std::cout << i << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>

using namespace std;
string s;
char decrypt[100];
int key,i;

int main(){
    while(getline(cin,s)){
        i = 0;
        const char *encrypt = s.c_str();
        while(encrypt[i] != '\0'){
            if(i == 0 && encrypt[i] - encrypt[i+1] == 12){
                key = 't' - encrypt[i];
                break;
            }
            else if(i >= 1 && encrypt[i-1] == ' ' && 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) % 26 + 'a';
            }
            else{
                decrypt[i] = encrypt[i];
            }
            i++;
        }
        while(i <= 99){
            decrypt[i] = '\0';
            i++;
        }
        printf("%s\n", decrypt);
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	string s;
	getline(cin, s);
	while(true){
		for(int i=0; i< s.size(); i++){
			if('a' <= s[i] && s[i] < 'z')s[i]++;
			else if(s[i] == 'z') s[i] = 'a';
		}
		bool possible = false;
		if(s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos){
			cout << s << endl;
			return 0;
		}
	}
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<windows.h>
using namespace std;
int main(){

    char a[100];
    while(scanf("%[^\n]",a) != EOF){
        bool flg = 0;
        for(int i = 1; i < 26; i++){
            unsigned char ans[100] = {0};
            for(int j = 0; j < strlen(a); j++){
                if(a[j] == ' ' || a[j] == '.') ans[j] = a[j];
                else ans[j] = a[j] + i;
                if(ans[j] > 'z') ans[j] -= 26;
            }
            for(int j = 0; j < strlen(a); j++){
                if(ans[j] == 't' && ans[j+1] == 'h'){
                    if(ans[j+2] == 'e' && ans[j+3] == ' ')flg = 1;
                    if(ans[j+2] == 'i' && ans[j+3] == 's' && ans[j+4] == ' ')flg = 1;
                    if(ans[j+2] == 'a' && ans[j+3] == 't' && ans[j+4] == ' ')flg = 1;
                }
                if(flg){
                    if(j == 0){
                        cout << ans << endl;
                        goto end;
                    }
                    else{
                        if(ans[j-1] == ' '){
                            cout << ans << endl;
                            goto end;
                        }
                    }
                }
            }
        }
        end:;
        fflush(stdin);
    }

    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
bool isAlpha(char ch){
  return ('a'<=ch&&ch<='z');
}
string change(string str){
  for(int i=0;i<(int)str.size();i++){
    if(isAlpha(str[i])){
      if(str[i]=='z')str[i]='a';
      else str[i]++;
    }
  }
  return str;
}
string st(string str,int x,int y){
  string res="";
  for(int i=x;i<x+y;i++)res.push_back(str[i]);
  return res;
}
int main(){
  string str;
  string a ="abcdefghi";
  int flg;
  while(getline(cin,str)){
    flg=0;
    for(int i=0;i<26;i++){
      str=change(str);
      for(int j=0;j+3<=(int)str.size();j++)
	if(st(str,j,3)=="the")flg=1;
      if(flg)break;
      for(int j=0;j+4<=(int)str.size();j++)
	if(st(str,j,4)=="this")flg=1;
      if(flg)break;
      for(int j=0;j+4<=(int)str.size();j++)
	if(st(str,j,4)=="that")flg=1;
      if(flg)break;
    }
    cout<<str<<endl;
  }
  
  return 0;
}

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

void Rest(char *before, char lag);

char ans[81];

int main(void)
{
	char before[81];
	
	scanf("%[^\n]", before);
	
	if (before[0] == 't'){
		printf("%s\n", before);
	}
	else if (before[0] < 't'){
		Rest(before, 't' - before[0]);
		printf("%s\n", ans);
	}
	else if (before[0] > 't'){
		Rest(before, before[0] - 't');
		printf("%s\n", ans);
	}
	
	return (0);
}

void Rest(char *before, char lag)
{
	int i;
	for (i = 0; before[i] != '\0'; i++){
		
		if (before[i] >= 'a' && before[i] <= 'z' ||
			before[i] >= 'A' && before[i] <= 'Z'){
			
			if (before[i] - lag < 'a'){
				ans[i] = before[i] - lag + 26;
			}
			else if (before[i] - lag > 'z'){
				ans[i] = before[i] - lag - 26;
			}
			else {
				ans[i] = before[i] - lag;
			}
		}
		else {
			ans[i] = before[i];
		}
	}
	ans[i] = '\0';
}

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

bool is_valid(const std::string& str) {
	if (str.find("the") != std::string::npos ||
		str.find("this") != std::string::npos ||
		str.find("that") != std::string::npos) {
		return true;
	}
	return false;
}

int main() {
	std::string str;
	std::getline(std::cin, str);
	
	std::string ans;
	const int limit = 'z' - 'a' + 1;
	for (int i = 0; i < limit; ++i) {
		for (auto c : str) {
			int elem = c + i;
			if (c >= 'a' && c <= 'z') {
				if (elem > 'z') {
					elem = 'a' + elem - ('z' + 1);
				}
				ans.push_back(elem);
			} else {
				ans.push_back(c);
			}
		}
		if (is_valid(ans)) {
			std::cout << ans << std::endl;
		}
		ans.clear();
	}
}