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 <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main() {

	string crypted;
	string encrypted;
	getline(cin, crypted);
	int len = crypted.size();
	
	while(true){
		for(int i=0; i<len; i++){
			if(crypted[i] >= 'a' && crypted[i] <= 'z'){
				crypted[i] =  (crypted[i] - 97 + 1) % 26 + 97;
			}
		}
		if(crypted.find("the", 0) != string::npos || crypted.find("this", 0) != string::npos || crypted.find("that", 0) != string::npos){
			cout << crypted;
			break;
		}
	}
	printf("\n");

	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
string S; char T[29] = "abcdefghijklmnopqrstuvwxyz. "; int x[100000];
int main() {
	getline(cin, S);
	for (int i = 0; i < 100000; i++) { x[i] = 100000; }
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j < 28; j++) {
			if (T[j] == S[i]) {
				x[i] = j;
			}
		}
	}
	for (int h = 0; h < 26; h++) {
		for (int i = 0; i < S.size(); i++) {
			if (x[i] == 19 && x[i + 1] == 7 && x[i + 2] == 8 && x[i + 3] == 18) {
				goto E;
			}
			if (x[i] == 19 && x[i + 1] == 7 && x[i + 2] == 0 && x[i + 3] == 19) {
				goto E;
			}
			if (x[i] == 19 && x[i + 1] == 7 && x[i + 2] == 4) {
				goto E;
			}
		}
		for (int i = 0; i < S.size(); i++) {
			if (x[i] < 26) {
				x[i]++;
				x[i] %= 26;
			}
		}
	}
E:;
	for (int i = 0; i < S.size(); i++) {
		cout << T[x[i]];
	}
	cout << endl;
}

C++: #include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

bool includes_keyword(const char *str) {
  const static char *keywords[] = { "the", "this", "that" };
  for (const auto keyword : keywords) {
    const char *pos = strstr(str, keyword);
    if (pos == NULL) { continue; }
    if (pos != str && isalpha(pos[-1])) { continue; }
    if (isalpha(pos[strlen(keyword)])) { continue; }
    return true;
  }
  return false;
}

int main() {
  char *cipher = NULL;
  size_t buffer_size = 0;
  ssize_t len;
  while ((len = getline(&cipher, &buffer_size, stdin)) > 0) {
    if (cipher[len - 1] == '\n') {
      cipher[len - 1] = '\0';
      len -= 1;
    }

    char decoded[81];
    for (int i = 0; i < 26; ++i) {
      strcpy(decoded, cipher);
      for (int j = 0; j < len; ++j) {
        if (islower(decoded[j])) {
          decoded[j] += i;
          if (!islower(decoded[j])) { decoded[j] -= 26; }
        }
      }
      if (includes_keyword(decoded)) { break; }
    }
    puts(decoded);
  }

  free(cipher);

  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
int main(){std::string s;while(std::getline(std::cin,s)){char b[81],*p,*c;c=b;strcpy(b,s.c_str());int gap=0;do{p=strtok(c," .\n");if(p!=NULL){int l=strlen(p);if(l>=3&&p[0]-p[1]=='t'-'h'){if(l==3){if(p[0]-p[2]=='t'-'e'){gap='t'-p[0];break;}}else if(l==4){if(p[0]-p[2]=='t'-'i'&&p[0]-p[3]=='t'-'s'){gap='t'-p[0];break;}else if(p[0]-p[2]=='t'-'a'&&p[0]-p[3]==0){gap='t'-p[0];break;}}}}c=NULL;}while(p!=NULL);for(std::string::iterator it=s.begin();it!=s.end();++it){if(*it!=' '&&*it!='.'&&*it!='\n'){std::cout<<static_cast<char>(*it+gap);}else{std::cout<<*it;}}puts("");}}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    char str[81] = {'\0'};
    int i, j, k;
    bool check;
    char gar[5];

    while(gets(str)){
        check = true;
        while(check){
            i = k = 0;
            while(str[i] != '.'){
                if(str[i] != ' ')
                    str[i]++;
                if(str[i] == 'z' + 1){
                    str[i] = 'a';
                }
                i++;
            }
            while(str[k + 4]){
                if( (str[k] == 't' && str[k + 1] == 'h' && str[k + 2] == 'i' && str[k + 3] == 's') || (str[k] == 't' && str[k + 1] == 'h' && str[k + 2] == 'a' && str[k + 3] == 't') || (str[k] == 't' && str[k + 1] == 'h' && str[k + 2] == 'e'))
                    check = false;
                    break;
            }
            k++;
        }
    cout << str << endl;
    }
}

C++: #include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <regex>

using namespace std;

string decode(string inp,int n){
    for(int i=0;i<inp.length();i++){
        if('a'<=inp[i]&&inp[i]<='z'){
            if(inp[i]-n<'a'){
                inp[i]='z'-(n-(inp[i]-'a')-1);

            }else{
                inp[i]=inp[i]-n;
            }
        }
    }
    return inp;
}
int main(){
    string input,decoded;
    regex pattern("(the)|(this)|(that)");
    while(getline(cin,input)){
        for(int i=0;i<26;i++){
            decoded=decode(input,i);
            if(regex_search(decoded.begin(),decoded.end(),pattern)){
                break;
            }
        }
        cout << decoded << endl;
    }
    return 0;
}

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

using namespace std;

string
caesar (string str, int n)
{
  const string table = "abcdefghijklmnopqrstuvwxyz";
  string ans (str.length (), ' ');
  for (int i = 0; i < str.length (); i++)
    {
      int buf = table.find (str[i]);
      if (buf == string::npos)
	{
	  ans[i] = str[i];
	}
      else
	{
	  ans[i] = (buf + n < table.length ())? table[buf + n]
	    : table[buf + n - table.length ()];
	}
    }
  return ans;
}

int
main ()
{
  string str;
  getline (cin, str);
  string after;
  for (int i = 0; i <= 25; i++)
    {
      after = caesar (str, i);
      if (after.find ("the") != string::npos)
	break;
      if (after.find ("this") != string::npos)
	break;
      if (after.find ("that") != string::npos)
	break;
    }
  cout << after << endl;
}

C++: #include <iostream>
#include <string>
#include <stdio.h>

#define NUM_OF_ALPHABET ('z' - 'a' + 1)

bool isValidResult(const std::string str);
bool decodeStr(const std::string srcStr, std::string& dstStr, int decodeNum);

int main(void)
{
	std::string inputStr;
	std::string outputStr;

	char line[100];
	fgets(line, sizeof(line), stdin);
	inputStr = line;

	for (int i = 0; i < NUM_OF_ALPHABET; i++) {
		if (decodeStr(inputStr, outputStr, i)) {
			std::cout << outputStr;
			break;
		}
		outputStr.clear();
	}
	return 0;
}

bool isValidResult(const std::string str)
{
	if (str.find(" the") != std::string::npos || str.find(" this") != std::string::npos || str.find(" that") != std::string::npos ||
		str.find("the ") != std::string::npos || str.find("this ") != std::string::npos || str.find("that ") != std::string::npos) {
		return true;
	}
	else {
		return false;
	}
}

bool decodeStr(const std::string srcStr, std::string& dstStr, int decodeNum)
{
	for (int i = 0; i < srcStr.size(); i++) {
		if (srcStr.at(i) >= 'a' && srcStr.at(i) <= 'z') {
			unsigned char tmpChar;
			tmpChar = srcStr.at(i) + decodeNum;
			if (tmpChar > 'z') {
				tmpChar -= NUM_OF_ALPHABET;
			}
			dstStr.push_back(tmpChar);
		}
		else {
			dstStr.push_back(srcStr.at(i));
		}
	}
	if (isValidResult(dstStr)) {
		return true;
	}
	else {
		return false;
	}
}