Go: package main

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

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 reflect.DeepEqual(infos, []string{}) {
			break
		}
		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>

bool is_valid(const std::string& s) {
	std::string str(" ");
	str.append(s);
	for (int i = 0; i < str.length(); ++i) {
		if (str.at(i) == '.') {
			str[i] = ' ';
		}
	}
	str.push_back(' ');
	
	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)) {
			break;
		}
		ans.clear();
	}
	
	std::cout << ans << std::endl;
}

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

int main(void){
    string str;
    while(getline(cin, str)){
        for(int i=0; i<26; i++){
            for(int j=0; j<str.size(); j++){
                if(str[j]!=' ' && str[j]!='.'){
                    str[j]++;
                    if(str[j]>'z') str[j]-=26;
                }
            }
            if(str.find("the")!=string::npos){
                cout<<str<<endl;
                break;
            }else if(str.find("this")!=string::npos){
                cout<<str<<endl;
                break;
            }else if(str.find("that")!=string::npos){
                cout<<str<<endl;
                break;
            }
        }
    }
}

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


int checkCaesarChipher(string str1, string str2){
	int a[1000],b[1000];
	bool flag = false;
	
	for(unsigned int i=0 ; i<str1.size()-1 ; i++){
		a[i] = (str1[0] - str1[i] + 26 - 'a') % 26;
		b[i] = (str2[0] - str2[i] + 26 - 'a') % 26;
		if(a[i]==b[i]){
			flag = true;
		}else{
			flag = false;
			break;
		}
	}
	if(flag){
		return (str2[0] - str1[0]);
	}else{
		return 0;
	}
}


int main(){
	string str, hoge, key;
	char s[800];
	int j, ans;
	
	while( getline(cin,str) ){
		j=0;
		ans=0;
		for(int i=0 ; i<str.size() ; ++i){
			ans = 0;
			if( str[i] == ' ' || i==str.size()-1){
				if(i==str.size()-1){
					hoge = str.substr(j,i-j+1);
				}else{
					hoge = str.substr(j,i-j);
				}
				j = i+1;
				
				if(hoge.size()==3){
					key = "the";
					if(checkCaesarChipher( key , hoge )!=0){
						ans = checkCaesarChipher( key , hoge );
						break;
					}
				}
				if(hoge.size()==4){
					key = "that";
					if(checkCaesarChipher( key , hoge )!=0){
						ans = checkCaesarChipher( key , hoge );
						break;
					}
					key = "this";
					if(checkCaesarChipher( key , hoge )!=0){
						ans = checkCaesarChipher( key , hoge );
						break;
					}
				}
			}
		}
		if(ans!=0){
			for(int i=0 ; i<str.size() ; i++){
				if(str[i]>='a' && str[i]<='z'){
					str.at(i) -= ans;
				}
			}
			cout << str << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main()
{
	string S , T;
	while(getline(cin , S))for(size_t i = 0; i < 26; i++)
	{
		for(auto &x : S)if('a' <= x&&x <= 'z')if(++x > 'z')x -= 26;
		stringstream SS;
		SS << S;
		vector<string>VS;
		while(SS >> T)if(T == "the" || T == "this" || T == "that" || T == "ths." || T == "this." || T == "that.")
		{
			cout << S << endl;
			break;
		}
	}
}

C++: #include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
void caesar(char *s, int n) {
  char c;
  while (c = *s) {
    if (c >= 'A' && c <= 'Z')
      *s = 'A' + (c - 'A' + n) % 26;
    if (c >= 'a' && c <= 'z') 
      *s = 'a' + (c - 'a' + n) % 26;
    s++;
  }
}
int main() {
  int n;
  char s[81];
  scanf("%80[^\n]s", s);
  for (n = 0; n < 26; n++) {
    caesar(s, 1);
    if (strstr(s, "the") || strstr(s, "this") || strstr(s, "that")) {
      cout << s << endl;
      break;
    }
  }
  return 0;
}

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

using namespace std;

int main(){

	char buf[81],result[81];
	bool FLG;
	short length;

	while(fgets(buf,81,stdin)!=0){
		FLG = false;
		length = 0;
		for(int i=0;buf[i]!='\0';i++)length++;
		for(int i=0;i<=25;i++){ //?????????????????°
			for(int k=0;buf[k]!='\0';k++){
				if(buf[k] >= 97 && buf[k] <= 122){
					if(buf[k]+i<=122){
						result[k]=buf[k]+i;
					}else{
						result[k]=97+(buf[k]+i-123);
					}
				}else{
					result[k]=buf[k];
				}
				result[k+1]='\0';
			}
			for(int k=0;result[k]!='\0';k++){
				// the this that ????????????????????????????????????
				if(length==4){
					if(result[0]=='t'&&result[1]=='h'&&result[2]=='e'&&result[3]=='.'){
						FLG=true;
						break;
					}
				}else{
					//??????
					if(result[0]=='t'&&result[1]=='h'&&result[2]=='e'&&result[3]==' '){
						FLG=true;
						break;
					}else if(result[0]=='t'&&result[1]=='h'&&result[2]=='i'&&result[3]=='s'&&result[4]==' '){
						FLG=true;
						break;
					}else if(result[0]=='t'&&result[1]=='h'&&result[2]=='a'&&result[3]=='t'&&result[4]==' '){
						FLG=true;
						break;
					}

					//????°?
					if(result[length-1]=='.'&&result[length-2]=='e'&&result[length-3]=='h'&&result[length-4]=='t'&&result[length-5]==' '){
							FLG=true;
							break;
					}
					if(length>5&&result[length-1]=='.'&&result[length-2]=='s'&&result[length-3]=='i'&&
							result[length-4]=='h'&&result[length-5]=='t'&&result[length-6]==' '){
							FLG=true;
							break;
					}else if(length>5&&result[length-1]=='.'&&result[length-2]=='t'&&result[length-3]=='a'&&
							result[length-4]=='h'&&result[length-5]=='t'&&result[length-6]==' '){
							FLG=true;
							break;
					}


					for(int p=4;result[p]!='\0';p++){
						if(result[p]==' ' && result[p-1] == 'e' && result[p-2] == 'h' && result[p-3] == 't' && result[p-4] == ' '){
							FLG = true;
							break;
						}
					}
					if(FLG)break;
					for(int p=5;result[p]!='\0';p++){
						if(result[p]==' ' && result[p-1] == 's' && result[p-2] == 'i' && result[p-3] == 'h' && result[p-4] == 't' && result[p-5] == ' '){
							FLG = true;
							break;
						}
					}
					if(FLG)break;
					for(int p=5;result[p]!='\0';p++){
						if(result[p]==' ' && result[p-1] == 't' && result[p-2] == 'a' && result[p-3] == 'h' && result[p-4] == 't' && result[p-5] == ' '){
							FLG = true;
							break;
						}
					}
					if(FLG)break;
				}
			}
			if(FLG)break;
		}
		printf("%s\n",result);

	}

    return 0;
}