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

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

// determine whether it is "the","this" or "that"
char get_shift(string w) {
	char sh = 't' - w.front();
	for_each(w.begin(),w.end(),[sh](char &c) {
		if (c != '.') {
			c += sh;
			if (c > 'z') {
				c -= (char)26;
			} else if (c < 'a') {
				c += (char)26;
			}
		}
	});
	if (w.find("the") == string::npos && w.find("this") == string::npos && w.find("that") == string::npos) {
		sh = '\0';
	}
	return sh;
}

int main() {
	string s;
	while (getline(cin,s)) {
		istringstream stream(s);
		string w;
		char sh;
		while (stream >> w) {
			while (!w.empty() && w.front() == '.') {
				w.erase(0,1);
			}
			while (!w.empty() && w.back() == '.') {
				w.pop_back();
			}
			if (!w.empty()) {
				if ((sh = get_shift(w)) != '\0') {
					break;
				}
			}
		}
		for_each(s.begin(),s.end(),[sh](char &c) {
			if (c >= 'a' && c <= 'z') {
				c += sh;
				if (c > 'z') {
					c -= (char)26;
				} else if (c < 'a') {
					c += (char)26;
				}
			}
		});
		cout << s << endl;
	}
}

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

using namespace std;

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