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 <list>
using namespace std;

int main(void)
{
    list<string> input;
    int dec = 0;
    string s;
    while (cin >> s)
    {
        input.push_back(s);

        if (dec == 0)
        {
            int d;
            d = s[0] - 't';

            string t = "";
            for (int i = 0; i < s.length(); i++)
                t += s[i] - d;

            if (t == "the" || t == "this" || t == "that")
                dec = d;
        }
    }
    int n = 0;
    for (list<string>::iterator i = input.begin(); i != input.end(); i++)
    {
        n++;
        string out = *i;
        for (int j = 0; j < out.length(); j++)
        {
            if (out[j] != '.')
            {
                cout << (char)(out[j] - dec);
            }
            else
            {
                cout << '.';
            }
        }
        if(n < input.size()){
            cout << ' ';
        }
    }

    cout << endl;
    return 0;
}

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

int main(){
	string str[100];
	int k = 0;
	int zure[100];
	bool flag[100] = {false};
	while(getline(cin, str[k])){
		for(int j = 0; j < 26; j++){
			for(int i = 0; i < str[k].size()-2; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'e'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			for(int i = 0; i < str[k].size()-3; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'i'+j && str[k][i+3] == 's'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			for(int i = 0; i < str[k].size()-3; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'a'+j && str[k][i+3] == 't'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			k++;
		}
	}
	for(int j = 0; j < k; j++){
		for(int i = 0; i < str[j].size(); i++){
			if(str[j][i] >= 'a' && str[j][i] <= 'z'){
				str[j][i] = str[j][i]-zure[j];
				if(str[j][i] < 'a'){
					str[j][i] = str[j][i]+26;
				}
			}
		}
		cout << str[j] << endl;
	}
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


int main()
{
	string a;

	while (getline(cin, a), cin){
		vector<string> aa;

		auto left = a.begin();

		while (true){
			auto right = left;
			while (right != a.end() && *right != ' ')++right;

			aa.emplace_back(left, right);
			if (right == a.end())
				break;

			left = right + 1;
		}


		string c[3] = { "this", "that", "the" };

		vector<string> nn;
		vector<string> kk;
		for (auto x : aa){
			auto n = x.length();
			if (n == 3){
				kk.push_back(x);
			}
			if (n == 4){
				nn.push_back(x);
			}
		}

		for (auto x : kk){
			auto n1 = x[0] - c[2][0];
			bool f(true);

			for (int i = 1; i < 3; ++i){
				if (n1 != x[i] - c[2][i])
					f = false;
			}

			if (f){
				int i(0);
				for (auto x : aa){
					for (auto y : x){

						if ('a' > y || 'z' < y){
							std::cout << y;
							continue;
						}

						int q = y - 'a';
						if (q - n1 < 0){
							q = 26 - n1;
						}
						else
							q -= n1;

						std::cout << (char)(q + 'a');
					}
					if (i < aa.size() - 1)
						std::cout << " ";
					++i;
				}
				std::cout << endl;
				goto END;
			}
		}

		for (auto x : nn){
			auto n1 = x[0] - c[0][0];
			auto n2 = x[0] - c[1][0];
			bool f(true);
			bool f2(true);

			for (int i = 1; i < 4; ++i){
				if (n1 != x[i] - c[0][i])
					f = false;
				if (n2 != x[i] - c[1][i])
					f2 = false;
			}

			if (f){
				int i(0);
				for (auto x : aa){
					for (auto y : x){
						if ('a' > y || 'z' < y){
							std::cout << y;
							continue;
						}

						int q = y - 'a';
						if (q - n1 < 0){
							q = 26 - n1;
						}
						else
							q -= n1;

						std::cout << (char)(q + 'a');
					}
					if (i < aa.size() - 1)
						std::cout << " ";
					++i;
				}
				std::cout << endl;
				goto END;
			}
			else if (f2){
				int i(0);
				for (auto x : aa){
					for (auto y : x){
						if ('a' > y || 'z' < y){
							std::cout << y;
							continue;
						}

						int q = y - 'a';
						if (q - n2 < 0){
							q = 26 - n2;
						}
						else
							q -= n2;

						std::cout << (char)(q + 'a');
					}
					if (i < aa.size() - 1)
						std::cout << " ";
					++i;
				}
				std::cout << endl;
				goto END;
			}

		}
	END:;
	}
	return 0;
}

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

using namespace std;

int main() { 
  string input_str;

  int shift = 1;
  while (getline(cin, input_str)) {
    for (int shift = 1; shift < 26; shift++) {
      string output_str = "";
      for (int str_i = 0; str_i < input_str.size(); str_i++) {
        char part = input_str[str_i];
        if (part >= 'a' && part <= 'z')
          part = 'a' + (part - 'a' + shift) % 26;
        output_str += part;
      }
      if (output_str.find("the") != string::npos || output_str.find("this") != string::npos || output_str.find("that") != string::npos) {
        cout << output_str << endl;
        break;
      }
    }
  }

  return 0;
}

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

using namespace std;

int main(){
	string ciph;

	while(getline(cin,ciph)){
		int len=ciph.length();
		bool match=false;
		for(int i=0;i<26;i++){
			for(int j=0;j<len;j++){
				if(islower(ciph[j])){
					ciph[j]++;
					if(ciph[j]>'z')	ciph[j]-=26;
				}
			}

			for(int j=0;j<len-2;j++){
				if(ciph.substr(j,3)=="the"
				&& !islower(ciph[j+3])
				&& (j==0 || !islower(ciph[j-1]))){
					match=true;
				}
			}
			if(match)	break;

			for(int j=0;j<len-3;j++){
				if(ciph.substr(j,4)=="this"
				&& !islower(ciph[j+4])
				&& (j==0 || !islower(ciph[j-1]))){
					match=true;
				}
			}
			if(match)	break;

			for(int j=0;j<len-3;j++){
				if(ciph.substr(j,4)=="that"
				&& !islower(ciph[j+4])
				&& (j==0 || !islower(ciph[j-1]))){
					match=true;
				}
			}
			if(match)	break;
		}
		cout<<ciph<<endl;
	}

	return 0;
}