Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func incrementByte(b byte) byte {
	if b >= 97 && b < 122 {
		return b + 1
	} else if b == 122 {
		return 97
	}
	return b
}

func main() {
	scanner.Split(bufio.ScanLines)

	for {
		line := nextString()
		if len(line) == 0 {
			break
		}
		for i := 0; i <= 26; i++ {
			decoded := []byte{}
			for j := 0; j < len(line); j++ {
				decoded = append(decoded, incrementByte(line[j]))
			}
			line = string(decoded)
			if strings.Contains(line, "the") || strings.Contains(line, "this") || strings.Contains(line, "that") {
				fmt.Println(line)
				break
			}
		}
	}
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
using namespace std;
int main(){
	
	char s[1000];
	while(cin.getline(s,1000)){
		for(int i=0;s[i]!='\0';i++){
			if((s[i]-s[i+1]=='t'-'h')&&(((s[i+1]-s[i+2]=='h'-'i')&&(s[i+2]-s[i+3]=='i'-'s'))||(s[i+1]-s[i+2]=='h'-'e')||((s[i+1]-s[i+2]=='h'-'a')&&(s[i+2]-s[i+3]=='a'-'t')))){
				for(int j=0;s[j]!='\0';j++){
					if((s[j]!=' ')&&(s[j]!='.')&&(s[j]!='\n')){
						if((s[j]+'t'-s[i]-'a')%24<0){
							putchar('z'+1+(s[j]+'t'-s[i]-'a')%24);
						}else{
							putchar((s[j]+'t'-s[i]-'a')%24+'a');
						}
					}else{
						putchar(s[j]);
					}
				}cout<<endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

char shift(char c, int n) {
  if (c >= 'a' && c <= 'z')
    return (c + n <= 'z') ? c + n : 'a' + (c + n - 'z' - 1);
  else
    return c;
}

bool is_abc(char a) {
  return a >= 'a' && a <= 'z';
}

bool exist(string str, string c) {
  int id = str.find(c, 0);
  while (id != string::npos) {
    if (id > 0 && is_abc(str[id-1])) {
      id++;
      id = str.find(c, id);
    } else if (id + c.length() < str.length() && is_abc(str[id + c.length()])) {
      id++;
      id = str.find(c, id);
    } else {
      return true;
    }
  }
  return false;
}

int main() {
  // ifstream cin("../test.txt");
  vector<string> _the(26);
  vector<string> _this(26);
  vector<string> _that(26);
  _the[0] = "the";
  _this[0] = "this";
  _that[0] = "that";
  for (int i = 1; i < 26; i++) {
    for (int j = 0; j < 3; j++) {
      _the[i] += shift(_the[0][j], i);
    }
    for (int j = 0; j < 4; j++) {
      _this[i] += shift(_this[0][j], i);
      _that[i] += shift(_that[0][j], i);
    }
  }

  string str, nstr;
  // 復号化
  while (getline(cin, str)) {
    if (str.length() == 0) break;
    nstr = "";
    for (int i = 1; i < 26; i++) {
      if ( exist(str, _the[i]) || exist(str, _this[i]) || exist(str, _that[i])) {
        int len = str.length();
        for (int j = 0; j < len; j++) {
          nstr += shift(str.at(j), 26 - i);
        }
        break;
      }
    }

    cout << nstr << endl;
  }
  // 暗号化
  // while (getline(cin, str)) {
  //   for (int i = 1; i < 26; i++) {
  //     nstr = "";
  //     int len = str.length();
  //     for (int j = 0; j < len; j++) {
  //       nstr += shift(str[j], i);
  //     }
  //     cout << nstr << endl;
  //   }
  // }
}

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

bool checkString(int* key, string s);
void rotateChar(string* s, int i);

int main()
{
    list<string> table;
    string s;

    while(cin>>s) table.push_back(s);
    
    int key;
    list<string>::iterator i;
    for(i=table.begin(); i!=table.end(); i++){
        // cout << *i << " ";
        if( i->size() == 3 || i->size() == 4 )
            if( checkString(&key, *i) ) break;
    }
    
    int flag = 0;
    for(i=table.begin(); i!=table.end(); i++){
        if(!flag){
            rotateChar( &(*i), key);
            cout << *i;
            flag = 1;
        }else{
            rotateChar( &(*i), key);
            cout << " " << *i ;
        }
    }
    cout << endl;
            
    return 0;
}

void rotateChar(string* s, int i) // iは何文字ずらしたいか
{

    for(int j=0; j<s->size(); j++){
        if(!isalpha(s->at(j))){continue;}
        char c = s->at(j) - 'a';
        s->at(j) = 'a' + (c+i)%26;
    }
}

bool checkString(int* key, string s)
{

    for(int i=0; i<26; i++){
        string tmp = s;
        rotateChar(&tmp, i);
        // cout << tmp << endl;
        if( tmp=="the" || tmp=="this" || tmp=="that" ){
            *key=i;
            return true;
        }
    }
    return false;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
bool h[1000010]={false};
int main(){
	string s;
	while(getline(cin,s)){
		while(s.find("this")==string::npos&&s.find("that")==string::npos&&s.find("the")==string::npos){
			rep(i,s.size())if(isalpha(s[i])){
				if(s[i]=='z')s[i]='a';
				else s[i]++;
			}
		}
		cout<<s<<endl;
	}
}

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

int main(){
  string word[111];
  string com[3]={"the","this","that"};
  int cou=0;
  while(cin >> word[cou]){
    cou++;
  }
  cout << endl;

  while(1){
    bool flag = false;
    for(int i=0;i<cou;i++){
      for(int j=0;j<word[i].size();j++){
	if(word[i][j] == 'z'){
	  word[i][j] = 'a';
	}
	else if(word[i][j] >= 'a' && word[i][j] <= 'z'){
	  word[i][j]++;
	}
      }
      for(int j=0;j<3;j++){
	if(word[i] == com[j]){
	  flag = true;
	  break;
	}
      }
    }
    if(flag == true){
      break;
    }
  }
  for(int i=0;i<cou;i++){
    cout << word[i];
    if(i == cou-1) cout << endl;
    else cout << " ";
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

char a[1000];
int b,c;

int main()
{
	while(fgets(a,999,stdin))
	{
		c=0;
		while(true)
		{
			if(strstr(a,"this")||strstr(a,"the")||strstr(a,"that"))break;
			for(b=0;b<strlen(a);b++)
			{
				if(islower(a[b]))
				a[b]++;
				if(a[b]>122)
				a[b]=97;
			}
			c++;
			if(c>27)
			break;
		}
		printf("%s",a);
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  string s,t;
  while(getline(cin,s)){

    for(int i = 0 ; i < 25 ; i++ ){
      t = "";
      for(int j = 0 ; j < (int)s.size() ; j++ ){
	int c = (int)(s[j] + i)%123;
	if('a'<=s[j] && s[j] <= 'z')t += (char)((c < 97) ? (c + 97): c);
	else t += s[j];
      }
      if(t.find("the") != string::npos ||
	 t.find("this") != string::npos ||
	 t.find("that") != string::npos ){
	cout << t << endl;
	break;
      }
    }
  }
  return 0;
}

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

using namespace std;

void CaesarCipher(const string&);
int main(){
  string str;
  while(getline(cin,str)){
    CaesarCipher(str);
  }
}


void CaesarCipher(const string& str){
  string diffstr=str;
  int diff=1;
  while(diffstr.find("the")==string::npos&&
        diffstr.find("this")==string::npos&&
        diffstr.find("that")==string::npos ){
    for(int i=0;i<str.length();i++){
      if( !isalpha(str[i])) continue;
      diffstr[i]=(diff+str[i]-'a')%26+'a';
    }
    diff++;
  }
  cout<<diffstr<<endl;
}