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 <string>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

// determine whether it is "the","this" or "that"
char is_article(string w) {
	char sh = '\0'; // shift defaults to 0
	if (w.size() == 3) {
		sh = 't' - w.front();
		for_each(w.begin(),w.end(),[sh](char &c) {
			c += sh;
			if (c > 'z') {
				c -= 'z'-'a'+1;
			} else if (c < 'a') {
				c += 'z'-'a'+1;
			}
		});
		if (w != "the") {
			sh = '\0';
		}
	} else if (w.size() == 4) {
		sh = 't' - w.front();
		for_each(w.begin(),w.end(),[sh](char &c) {
			c += sh;
			if (c > 'z') {
				c -= 'z'-'a'+1;
			} else if (c < 'a') {
				c += 'z'-'a'+1;
			}
		});
		if (w != "this" && w != "that") {
			sh = '\0';
		}
	}
	return sh;
}

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

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

bool isSmallAlphabet(char ch) {
  /* a ~ z(ascii) : 97 ~ 122 */
  if('a' <= ch && ch <= 'z') return true;
  else return false;
}

bool isHit(string str) {
  if(str.find("the") != str.npos) return true;
  else if(str.find("this") != str.npos) return true;
  else if(str.find("that") != str.npos) return true;
  else return false;
}

/* ????????¶??????????§£??? */
void CaesarCipher(string _str) {
  
  /* parameter??????????????¢??????????????????????????????????????? */
  for(int parameter = 0; parameter < 26; ++parameter) {
    string str = _str;
    for(int i = 0; i < (int)str.length(); ++i) {
      
      /* ?°?????????¢??????????????????????????? */
      if(isSmallAlphabet(str[i])) {
        str[i] += parameter;
        /* ???????????????????°?????????§???????????£??????*/
        if(!isSmallAlphabet(str[i])) {
          str[i] -= 26;
        }
      }

    }

    /* Find "the" or "this" or "that" */
    if(isHit(str)) {
      cout << str << endl;
    }
  }
}

int main() {
  string str;
  while(getline(cin, str)) {
    CaesarCipher(str);
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

// #define int long long

/* short */
#define pb push_back
#define print(Target) cout << Target << '\n'

/* REPmacro */
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

/* const */
const int INF = INT_MAX;

signed main()
{
  ios::sync_with_stdio(false);
  string s;

  while (getline(cin, s), s != ""){
    for (;s.find("the") == -1 && s.find("this") == -1 && s.find("that") == -1;){
      REP(i, s.size()){
        if ('a' <= s[i] && s[i] <= 'y'){
          s[i]++;
        } else if (s[i] == 'z'){
          s[i] = 'a';
        }
      }
    }
    print(s);
  }
  
  return (0);
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
typedef pair<int,char*> str;

int main(void){
	char s[81];
	vector<str> v;
	const char* cmp1="that";
	const char* cmp2="this";
	const char* cmp3="the";
	bool is_found=false;
	int pos=0,end_pos,diff;
	char c;

	scanf("%[^\n]",s);
	for(int i=0;i<81;i++){
		if(s[i]==' ' || s[i]=='.'){
			c=s[i];
			s[i]='\0';
			v.push_back(str(i-pos,s+pos));
			s[i]=c;
			pos=i+1;
		}else if(s[i]=='\0'){
			end_pos=i;
			break;
		}
	}

	for(int i=0;i<v.size();i++){
		is_found=false;

		diff=1000;
		if(v[i].first==4){
			for(int j=0;j<4;j++){
				if(diff==1000){
					diff=v[i].second[j]-cmp1[j];
				}else if(diff!=v[i].second[j]-cmp1[j]){
					is_found=true;
					break;
				}
			}

			if(!is_found) break;

			diff=1000;
			for(int j=0;j<4 && !is_found;j++){
				if(diff==1000){
					diff=v[i].second[j]-cmp2[j];
				}else if(diff!=v[i].second[j]-cmp2[j]){
					is_found=true;
					break;
				}
			}

			if(!is_found) break;
		}else if(v[i].first==3){
			diff=1000;
			for(int j=0;j<3;j++){
				if(diff==1000){
					diff=v[i].second[j]-cmp2[j];
				}else if(diff!=v[i].second[j]-cmp2[j]){
					is_found=true;
					break;
				}
			}
			if(!is_found) break;
		}
	}
	
	for(int i=0;i<end_pos;i++){
		if(s[i]!=' ' && s[i]!='.'){
			s[i]-=diff;
		}
	}

	printf("%s\n",s);


	return 0;
}

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

char buf[1000];
string enc, ans;

string decrypt(string s, int k) {
  string ret = "";
  for (int i=0; i<s.size(); i++) {
    char c = s[i];
    if ('a' <= c && c <= 'z') {
      ret += ('a' + ((c-'a')+k)%26);
    } else {
      ret += c;
    }
  }
  return ret;
}

int main() {
  while (1) {
    if (fgets(buf, 100, stdin) == NULL) break;
    enc = buf;
    for (int i=0;i<26;i++) {
      ans = decrypt(enc, i);
      if (ans.find("the") != string::npos) break;
      if (ans.find("this") != string::npos) break;
      if (ans.find("that") != string::npos) break;
    }

    printf("%s", ans.c_str());
  }
}

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

int main(){
  char a[100],b[100];
  for(int i;i<100;i++){
    a[i]='\0';
    b[i]='\0';
  }
  gets(a);
  int i=0;
  while(i<26){
    for(int j=0;!(a[j]=='\0');j++){
      if(0x61<=a[j]+i&&a[j]+i<=0x7A)
	b[j]+=i;
      else if(0x61<=a[j]&&a[j]<=0x7A){
	b[j]=a[j]-26+i;
      }
      else if(a[j]==' ')
	b[j]=' ';
      else if(a[j]=='.')
	b[j]='.';
      
    }
    if(strstr(b,"the")||strstr(b,"this")||strstr(b,"that"))
      break;
    i++;
  }
  for(int k=0;a[k]!='\0';k++)
    cout<<b[k];
  cout<<'\n';
  return 0;
}