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>

using namespace std;

int main()
{
    string s;

    while (getline(cin, s)) {
        while (s.find("the") == s.npos &&
                    s.find("this") == s.npos &&
                    s.find("that") == s.npos) {
            for (int i = 0; i < s.size(); i++) {
                if (s[i] >= 'a' || 'y' <= s[i]) {
                    s[i]++;
                } else {
                    s[i] = 'a';
                }
            }
        }
        cout << s << endl;
    }

    return 0;
}

C++: // clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define INFLL 1000000000000000000LL
#define MOD 1000000007
#define PI acos(-1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>

using namespace std;

// clang-format on

string f(string s) {
  rep(i, s.size()) {
    if ('a' <= s[i] && s[i] <= 'z') {
      s[i] = (s[i] - 'a' + 1) % ('z' - 'a') + 'a';
    }
  }
  return s;
}

main {
  string s;
  while (getline(cin, s)) {
    vs w;
    stringstream ss;
    ss << s;
    string x;
    while (ss >> x) {
      w.pb(x);
    }
    if (w.size() == 0) {
      continue;
    }
    for (bool b = false; !b;) {
      rep(i, w.size()) {
        string d = f(w[i]);
        string t[] = {"the", "the.", "this", "this.", "that", "that."};
        rep(i, 6) b |= d == t[i];
        w[i] = d;
      }
    }
    cout << w[0];
    loop(i, 1, w.size()) cout << ' ' << w[i];
    cout << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include<string>
#include<vector>
int main() {
	std::string s,a;
	std::getline (std::cin , s);
	int p = s[0] - 't';
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] != ' ' &&s[i]!= '.') {
			a += s[i] - p;
		}
		else a += s[i];
	}
	std::cout << a<< std::endl;
	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <string>
using namespace std;
char exch(char *ch,int m){
	if(*ch+m>'z') return (*ch+m-26);
	else if(*ch+m<'a') return (*ch+m+26);
	else return(*ch+m);
}
int main(){
	string str[81]; int diff; int i=0;int flag=0;
	while(cin >> str[i]){
	if(flag==0) diff='t'-str[i][0];
	if(flag==1) ;
	else if(str[i].size()==3 && exch(&str[i][1],diff)=='h' && exch(&str[i][2],diff)=='e') flag=1;
	else if(str[i].size()==4 && exch(&str[i][1],diff)=='h' && exch(&str[i][2],diff)=='i' && exch(&str[i][3],diff)=='s') flag=1;
	else if(str[i].size()==4 && exch(&str[i][1],diff)=='h' && exch(&str[i][2],diff)=='a' && exch(&str[i][3],diff)=='t') flag=1;
	i++;
	};
	for(int j=0;j<i;j++){
		if(j) cout << ' ' ;
		for(int k=0;k<str[j].size();k++){
			char ch=exch(&str[j][k],diff);
			if(str[j][k]-'a'>=0 && str[j][k]-'z'<=0) cout << ch ;
			else cout << str[j][k] ;
		};
	};
	cout << '\n' ;
}

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

int main(){
  string s;
  for(;getline(cin,s);){
    bool f=0;
    for (;!f;){
      for(int i=0;i<s.size();i++){
        if(s[i]>='a' && s[i]<='z'){
          s[i]--;
          if(s[i]<'a')s[i]='z';
        }
      }
      // cout << s.substr(0,5)<<endl;
      string t[3]={"the","this","that"};
      for(int i=0;!f&&i<3;i++){
        for(int j=0;!f&&j+t[i].size()<s.size();j++){
          if(s.substr(j,t[i].size())==t[i]){
            cout<<s<<endl;
            f=1;
          }
        }
      }
    }
  }
}

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

int suggest_cipher_num(std::string str)
{
  std::vector<std::string> token;
  int i = 0, j = str.find(" ", 0);
  while (j != std::string::npos) {
    token.push_back(str.substr(i, j - i));
    i = j + 1;
    j = str.find(" ", i);
  }
  token.push_back(str.substr(i, str.length() - i));
  
  for (auto it = token.begin(); it != token.end(); ++it) {
    std::string& tok = *it;
    if (tok.length() == 3) {
      // check if this token is ciphered "the"
      int diff[] = {tok[0] - tok[1], tok[1] - tok[2]};
      for (int i = 0; i < 2; i++) {
        if (diff[i] < 0) diff[i] += 'z' - 'a';
      }
      
      if (diff[0] == 't' - 'h' && diff[1] == 'h' - 'e') {
        return 't' - tok[0];        
      }
    }
    else if (tok.length() == 4) {
      // check if this token is ciphred "this" or "that"
      int diff[] = {tok[0] - tok[1], tok[1] - tok[2], tok[2] - tok[3]};
      if (diff[0] != 't' - 'h' && diff[0] + ('z' - 'a') != 't' - 'h') break;
      if (diff[1] == 'h' - 'i' || diff[1] - ('z' - 'a') == 'h' - 'i') {
        if (diff[2] == 'i' - 's' || diff[2] - ('z' - 'a') == 'i' - 's') {
          return 't' - tok[0];
        }
      }
      else if (diff[1] == 'h' - 'a' || diff[1] + ('z' - 'a') == 'h' - 'a') {
        if (diff[2] == 'a' - 't' || diff[2] - ('z' - 'a') == 'a' - 't') {
          return 't' - tok[0];
        }
      }
    }
  }
  return 0;
}

int main()
{
  std::string line;
  while (std::getline(std::cin, line)) {
    auto key = suggest_cipher_num(line);
    for (const auto& c: line) {
      if (c == ' ' || c == '.') {
        std::cout << c;
      } else if(c + key < 'a') {
        std::cout << static_cast<char>(c + key + 'z');
      } else {
        std::cout << static_cast<char>(c + key);
      }
    }
    std::cout << std::endl;
  }
  return 0;
}

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

int main() {
  string bstr;

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

  return 0;
}