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 <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main() {
    string s;
    while(getline(cin,s)) {
		string t;
		rep(j,0,26) {
			t.clear();
			rep(i,0,s.length()) {
				if('a' <= s[i] && s[i] <= 'z') t += (s[i] + j > 'z') ? (s[i] + j - 26) : (s[i] + j);
				else t += s[i];
			}
			if(t.find("this") != string::npos) break;
			else if(t.find("the") != string::npos) break;
			else if(t.find("that") != string::npos) break;
		}
		cout << t << endl;
	}
    return 0;
}

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

char shift(char in){
	if('a'<=in&&in<='y'){
		return in+1;
	}else if(in=='z'){
		return 'a';
	}else{
		return in;
	}	
}
int main(){
	char a[100];
	string data;
	while(cin.getline(a,100)){
	cout<<a<<endl;
		while(true){
			data=a;
			if(data.find("the")!=-1 || data.find("this")!=-1 || data.find("that")!=-1)
				break;
			for(int i=0;a[i]!='\0';i++){
				a[i]=shift(a[i]);
			}
//		cout<<a<<endl;
		}
		cout<<data<<endl;
	}
}

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

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

int main() {
	std::string str;
	std::getline(std::cin, str);
	
	std::string ans;
	const int limit = 'z' - 'a' + 1;
	for (int i = 0; i < limit; ++i) {
		for (auto c : str) {
			int elem = c + i;
			if (c >= 'a' && c <= 'z') {
				if (elem > 'z') {
					elem = 'a' + elem - 'z' - 1;
				}
				ans.push_back(elem);
			} else {
				ans.push_back(c);
			}
		}
		if (validate(ans)) {
			break;
		}
		ans.clear();
	}
	
	std::cout << ans << std::endl;
}

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

using namespace std;
string buf;
bool found(){
    return buf.find("this",0) != string::npos ||
        buf.find("that",0) != string::npos ||
        buf.find("the",0) != string::npos;
}

bool isalpha(char c){
    return 'a' <= c && c <= 'z';
}

int main(){
    getline(cin, buf);
    cout << buf << endl;
    while(!found()){
        for(int i=0; i<buf.size(); i++){
            if(isalpha(buf[i])) buf[i]++;
        }
        cout << buf << endl;
    }
    cout << buf << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <stdio.h>

using namespace std;

int pat[3][3];
int len[3];
int chr[3];
int zure;
int size;
bool atteru[3];
char text[100];

int main() {
	//cin >> text;
	gets(text);
	//int size = text.size();
	int pt = 0;
	size = 100;

	pat[0][0] = 't' - 'h';
	pat[0][1] = 'h' - 'e';
	pat[1][0] = 't' - 'h';
	pat[1][1] = 'h' - 'i';
	pat[1][2] = 'i' - 's';
	pat[2][0] = 't' - 'h';
	pat[2][1] = 'h' - 'a';
	pat[2][2] = 'a' - 't';
	chr[0] = 'e';
	chr[1] = 's';
	chr[2] = 't';
	len[0] = 3;
	len[1] = 4;
	len[2] = 4;

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			if (pat[i][j] < 0) pat[i][j] += 26;
		}
	}

	zure = -1;

	int cnt = 0;
	atteru[0] = true;
	atteru[1] = true;
	atteru[2] = true;
	for (int i = 0; i < size-1 && zure == -1; i++) {
		if (text[i+1] == ' ' || cnt > 3) continue;
		if (text[i] == ' ') {
			cnt = 0;
			atteru[0] = true;
			atteru[1] = true;
			atteru[2] = true;
			//cout << "yarinaoshi!" << endl;
			continue;
		}
		int dist = text[i] - text[i+1];
		if (dist < 0) dist += 26;
		for (int j = 0; j <= 2; j++) {
			if (!atteru[j]) continue;
			if (cnt >= len[j]-1) continue;
			if (dist != pat[j][cnt]) {
				atteru[j] = false;
				//cout << j << " ha tigau!" << endl;
				continue;
			} else if (cnt == len[j]-2) {
				//cout << j << " ha atteta!" << endl;
				zure = text[i+1] - chr[j];
				if (zure < 0) zure += 26;
				//cout << "zure = " << zure << endl;
			}
		}
		cnt++;
	}

	for (int i = 0; i < size; i++) {
		if (text[i] == EOF) break;
		if (text[i] < 'a' || text[i] > 'z') continue;
		text[i] = text[i] - zure;
		if (text[i] < 'a') text[i] += 26;
	}

	cout << text << endl;

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

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 c = 'z';
    for (int i = 0; i < len; ++i) {
      if (isalpha(cipher[i]) && c > cipher[i]) { c = cipher[i]; }
    }
    int shift_begin = 'a' - c;
    int shift_end = shift_begin + 26;
    char decoded[81];
    for (int shift = shift_begin; shift < shift_end; ++shift) {
      strcpy(decoded, cipher);
      for (int i = 0; i < len; ++i) {
        if (isalpha(decoded[i])) { decoded[i] += shift; }
      }
      if (includes_keyword(decoded)) {
        puts(decoded);
        break;
      }
    }
  }

  free(cipher);

  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main() {
	string a="";
	while (getline(cin, a)) {
		string b;
		int z=0,sum=0;
		for (int i = 0; i < a.length(); i++) {
			if (a[i] == ' ' || a[i] == '.' || a[i] == ',') {
				b = a.substr(z, i-z);
				int t = (int)'t';
				string c = "";				
				if (b.length() == 3 || b.length() == 4) {
					c = "";
					int w = t - (int)b[0];
					for (int i = 0; i < b.length(); i++) {
						int d = (char)((int)b[i] + w);
						if (d > 'z')
							d -= 26;
						else if (d < 'a')
							d += 26;
						c += (char)d;
					}
					if (c == "the" || c == "that" || c == "this") {
						sum = w;
						break;
					}
				}
				z = i + 1;
			}
		}
		string f = "";
		for (int i = 0; i < a.length(); i++) {
			if (a[i] != ' ' && a[i] != '.' && a[i] != ',') {
				int g = (int)a[i] + sum;
				if (g > (int)'z')
					g -= 26;
				else if (g < (int)'a')
					g += 26;
				f += (char)g;
			}
			else {
				f += a[i];
			}
		}
		cout << f << endl;
	}
}

C++: #include <stdio.h>

int main(void)
{
	char str[80];
	int num, num2;
	int i;
	
	while (fgets(str, 80, stdin) != NULL){
		num = 't' - str[0];
		i = 0;
		while (str[i] != '\0'){
			if (str[i] + num >= 'a' && str[i] + num <= 'z'){
				str[i] += num;
				if (str[i] > 'z'){
					num2 = str[i] - 'z';
					str[i] = num2 + 'a';
				}
				else if (str[i] < 'a'){
					num2 = 'a' - str[i];
					str[i] = 'z' - num2;
				}
			}
			i++;
		}
		printf("%s", str);
	}
	
	printf("\n");
	
	return (0);
}