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++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <ctype.h>

using namespace std;

inline char rotate(char c, int x){
    int r = x % 26;
    if(isalpha(c)){
        c += r;
    }

    return c;
}

inline char decode_from_t(char t, char tgt){
    int df = ('t' - t) % 26;
    tgt += df;
    return tgt;
}

char buf[82];
enum state {
    init,
    wait_h,
    after_th,
    rest_chars,
    wait_sep,
    other_word,
};

inline bool is_sep(char *c){
    return *c == '.' || *c == ' ';
}

// return diff.
int findTheThatThis(){
    state s = init;
    char *c = buf;
    char next, dec, t;

    while(*c != '\n'){
        switch (s) {
            case init:
                if(isalpha(*c)){
                    s = wait_h;
                    t = *c;
                }
                break;
            case wait_h:
                if(is_sep(c)){
                    s = init;
                }else{
                    dec = decode_from_t(t, *c);
                    if(dec == 'h'){
                        s = after_th;
                    }else{
                        s = other_word;
                    }
                }
                break;
            case after_th:
                if(is_sep(c)){
                    s = init;
                }else {
                    dec = decode_from_t(t, *c);
                    switch (dec) {
                        case 'e':
                            s = wait_sep;
                            break;
                        case 'i':
                            next = 's';
                            s = rest_chars;
                            break;
                        case 'a':
                            next = 't';
                            s = rest_chars;
                            break;
                        default:
                            s = other_word;
                            break;
                    }
                }
                break;
            case rest_chars:
                if(is_sep(c)){
                    s = init;
                }else{
                    dec = decode_from_t(t, *c);
                    if(dec == next){
                        s = wait_sep;
                    }else{
                        s = other_word;
                    }
                }
                break;
            case wait_sep:
                if(is_sep(c)){
                    return 't' - t;
                }else{
                    s = other_word;
                }
                break;
            case other_word:
                if(is_sep(c)){
                    s = init;
                }
                break;
        } // end switch
        c++;
    } // end while
    // not found
    return -1;
}

int main(int argc, char const* argv[])
{
    int dif;

    while (nullptr != fgets(buf, 82, stdin)) {
        dif = findTheThatThis();
        for (int i = 0; ; i++) {
            if(buf[i] == '\n'){
                buf[i] = '\0';
                puts(buf);
                break;
            }
            buf[i] = rotate(buf[i], dif);
        }
    }

        return 0;
}

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

int caesar[26][255], x, enkrip[100];
int thiss[] = {'t', 'h', 'i', 's'}, the[] = {'t', 'h', 'e'}, that[] = {'t', 'h', 'a', 't'};
string s;
int main() {
	for(int i = 0; i <= 25; i++) {
		for(char j = 'a'; j <= 'z'; j++) {
			if(j + i > 'z') x = j + i - 26; else x = j + i;
			caesar[i][x] = j;
		}
	}
	while(getline(cin, s)) {
	for(int k = 0; k <= 25; k++) {
		int l = 0, z = 0, zz = 0;
		for(int i = 0, j = s.size(); i != j; i++) {
			if(s[i] <= 'z' && s[i] >= 'a') {
				enkrip[i] = caesar[k][s[i]];
				if(enkrip[i] == thiss[l]) l++;
				if(enkrip[i] == the[z]) z++;
				if(enkrip[i] == that[zz]) zz++;
			} else {enkrip[i] = s[i]; if(l != 4) l = 0; if(z != 3) z = 0;if(zz != 4) zz = 0; }
		}
		if(l >= 4 || z >= 3 || zz >= 4) {
			for(int i = 0, j = s.size(); i != j; i++) {
				printf("%c", enkrip[i]);
			}
			printf("\n");
			break;
		}
	}}
	return 0;
}

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

int main(){
	std::string str;
	std::getline(std::cin,str);
	while(true){
		for(int j=0;j<str.size();j++){
			if(str[j]!=' '&&str[j]!='.'){
				int a=static_cast<int>(str[j]);
				a-=2;
				while(a<(int)'a')a+=26;
				while(a>(int)'z')a-=26;
				str[j]=static_cast<char>(a);
			}
		}
		if(str.find("the")!=-1||str.find("this")!=-1||str.find("that")!=-1)break;
	}
	std::cout<<str<<std::endl;
	return 0;
}

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

int main(){
	string s, strCopy;
	while ( getline(cin, s) ) {
		for(int j=0 ; j<26 ; j++){
			for(int i=0 ; i<s.size() ; i++){
				if( s[i] >= 'a' && s[i] <= 'z' ){
					s[i] = ( s[i] == 'z' )? 'a' : s[i] + 1;
				}
			}
			if( s.find( "the" ) != string::npos || s.find( "this" ) != string::npos || s.find( "that" ) != string::npos ){
				cout << s << endl;
			}
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#define N 100
using namespace std;

void hukugou(char str2[]){
  int i;

  while(1){

    for(i = 0;str2[i] != '\0';i++){
      if(str2[i] != ' ' && str2[i] != '\n'){
	str2[i] = (str2[i] - 'a' + 1) % 26 + 'a';
      }
    }

    if(strstr(str2, "the") != NULL || strstr(str2, "this") != NULL || strstr(str2, "that") != NULL){
      cout << str2;
      break;
    }
  }

}

int main(){
  char str[N];

  fgets(str, sizeof(str), stdin);

  hukugou(str);

  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main()
{
	string str,t;
	while(getline(cin,str))
	{
		for(int i = 1;i < 26;++i)
		{
			t = str;
			for(int j = 0;j < str.size();++j)
			{
				if(t[j] == ' ' || t[j] == '.') continue;
				t[j] = (t[j] - 'a' + i) % 26 + 'a';
			}
			if(t.find("that",0) != string::npos || t.find("this",0) != string::npos || t.find("the",0) != string::npos){
				cout << t << endl;
				break;
			}
		}
	}
	return 0;
}

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

int main(void){
  int len, cnt;
  string str;

  getline( cin, str );

  len = str.length();
  cnt = 0;

  while(true){
    if( str.find("the", 0) != string::npos
	|| str.find("this", 0) != string::npos 
	|| str.find("that", 0) != string::npos
	)
      break;
    for(int i = 0; i < len; i++){
      if( 'a' <= str[i] && str[i] <= 'z' ){
	str[i]++;
	if(str[i] > 'z')
	  str[i] = 'a';
      }
    }

    cnt++;
    if(cnt > 30)
      break;
  }
  
  cout << str;

  return 0;
}

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

using namespace std;

int main() {
    string a;
    
    getline(cin,a);
    
    while (1){
        if(a.find("this")!=-1 || a.find("this")!=-1 || a.find("this")!=-1){
            break;
        }
        
        for(int i=0; i<a.length(); i++){
            if(a[i]==' '|| a[i]=='.'){
                
            }else if(a[i]=='z'){
                a[i]='a';
            }else{
                a[i]++;
            }
        }

    }
    cout<<a<<endl;;
    
    
    return 0;
}