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 <vector>
#include <string>
using namespace std;
int main(){
	string s;
	while(getline(cin,s)){
		while(s.find("this")==-1 && s.find("that")==-1 && s.find("the")==-1){
			for(int i=0; i<s.length(); i++){
				if(s[i]>='a' && s[i]<'z')
					s[i]++;
				else if(s[i]=='z')
					s[i]='a';
			}
		}
		cout<<s<<endl;
	}
	return 0;
}

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

using namespace std;

void f(string &s)
{
    for (char &c : s) {
        if ('a' <= c && c <= 'z') c = (c - 'a' + 25) % 26 + 'a';
    }
}

int main()
{
    string s;

    while (getline(cin, s)) {
        while (s.find("the") == string::npos || s.find("this") == string::npos || s.find("that") == string::npos) f(s);
        cout << s << endl;
    }
}

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

bool is_contain_keywords(string str,vector<string>& keywords) {
  int cnt = 0;
  vector<string>::iterator key_itr = keywords.begin();
  while(key_itr != keywords.end()) {
    if(str.find(*key_itr) != string::npos) {
      return true;
    }
    key_itr++;
  }
  return false;
}

string decode(string cipher) {
  vector<string> keywords;
  keywords.push_back("the");
  keywords.push_back("this");
  keywords.push_back("that");

  int remind_shift = -1;
  int max_cnt = 0;
  int str_len = cipher.length();
  for(int shift = 0;shift < 'z' - 'a';shift++) {
    string str = cipher;
    for(int i=0;i<str_len;i++) {
      if('a' < cipher[i] && cipher[i] < 'z') {
        str[i] = (cipher[i] - 'a' + shift) % ('z' - 'a') + 'a';
      }
    }
    if(is_contain_keywords(str,keywords)) return str;
  }
  return "";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string cipher;
  while(getline(cin,cipher)) {
    cout << decode(cipher) << endl;
  }
}

C++: #include <iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<stack>
#include<queue>
#include<string>
#include<deque>
#include<set>
#define ll long long
using namespace std;


int main() 
{
	string ss;
	while(getline(cin,ss))
	{
		while(ss.find("the")==-1&&ss.find("this")==-1&&ss.find("that")==-1)
		{
			int i;
			for( i=0;i<ss.size();i++)
			{
				if('a'<=ss[i]&&ss[i]<'z')
				ss[i]++;
				else if(ss[i]=='z')
				ss[i]='a';
				
			}
		}
		cout<< ss <<endl;  
	}
	return 0;
	
}

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;
      }
      unsigned f_the = str.find("the", 0);
      unsigned f_this = str.find("this", 0);
      unsigned f_that = str.find("that", 0);
      if((f_the != string::npos && f_the == 0 && str[f_the + 3] == ' ') || (f_this != string::npos && f_this == 0 && str[f_this + 4] == ' ') || (f_that != string::npos && f_that == 0 && str[f_that + 4] == ' '))
	cout << str << endl;
      else if((f_the != string::npos && (str[f_the - 1] == ' ' || str[f_the - 1] == '.' || str[f_the - 1] == '\n') && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\n')) || (f_this != string::npos && (str[f_this - 1] == ' ' || str[f_this - 1] == '.' || str[f_this - 1] == '\n') && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\n')) || (f_that != string::npos && (str[f_that - 1] == ' ' || str[f_that - 1] == '.' || str[f_that - 1] == '\n') && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\n')))
	cout << str << endl;	 
    }
  }
}

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

int main() {

  string input;

  while(true) {
  if ( cin.eof() ) break;

  getline( cin, input );

  char c;
  for ( int i = 0; i < 26; i++ ) {

    string ans = "";
    for ( int j = 0; j < input.size(); j++ ) {

      c = input[j];
      if ( c >= 'a' && c <= 'z' ) {
	c = 'a' + ( c - 'a' + i )%26 ;
      }
      ans += c;

    }

    if ( ans.find( "the", 0 ) == string::npos && ans.find( "this", 0 ) == string::npos && ans.find( "that", 0 ) == string::npos ) continue;

    cout << ans << endl;

    break;

  }

  }

  return 0;

}

C++: require("fs").readFileSync("/dev/stdin","utf8").split('\n').map(function(i){for(s=26;s--;)r=i.replace(/[a-z]/g,function(j){return String.fromCharCode((j.charCodeAt(0)-97+s)%26+97)}),r.match(/th(e|is|at)/)?console.log(r):0})

C++: #include <cstdio>
#include <algorithm>
#include <string>

using namespace std;

void caesar_decipher(string &s, int d) {
    d %= 26;
    for (char &c: s)
        if (c >= 'a' && c <= 'z') {
            c += d;
            if (c < 'a') {
                c += 26;
            } else if (c > 'z') {
                c -= 26;
            }
        }
}

bool testcase_ends() {
    char buf[128];
    if (fgets(buf, 128, stdin) == NULL)
        return 1;

    string s(buf);

    string keywords[]={"the", "this", "that"};
    auto is_valid=[&](string &s)->bool {
        for (string &kw: keywords)
            if (s.find(kw) != string::npos)
                return true;

        return false;
    };

    for (int i=0; i<26; ++i) {
        if (is_valid(s)) break;

        caesar_decipher(s, 1);
    }

    printf("%s", s.c_str());
    return 0;
}

int main() {
    int solved=0;
    while (!testcase_ends())
        ++solved;

    return !solved;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

signed main(){
  string s;
  while(getline(cin,s)){
    vector<int> spe;
    REP(i,s.size())if(s[i]==' ')spe.PB(i);
    LOOP(i,1,27){
      string t;
      REP(j,s.size()-1){
        if(s[j]==' ')continue;
        if((s[j]+i)<=122){
          t+=(s[j]+i);
        }else{
          t+=((s[j]+i)-26);
        }
      }
      int f=0;
      REP(j,t.size()){
        if(t.substr(j,3)=="the"||t.substr(j,4)=="that"||t.substr(j,4)=="this"){
          int p=0;
          REP(k,t.size()){
            if(k==spe[p]-p-1){
              cout<<t[k]<<' ';
              p++;
            }else{
              cout<<t[k];
            }
          }
          cout<<'.'<<endl;
          f=1;
          break;
        }
      }
      if(f)break;
    }
  }
  return 0;
}