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>
using namespace std;
bool isAlpha(char ch){
  return ('a'<=ch&&ch<='z');
}
string change(string str){
  for(int i=0;i<(int)str.size();i++){
    if(isAlpha(str[i])){
      if(str[i]=='z')str[i]='a';
      else str[i]++;
    }
  }
  return str;
}
int main(){
  int i,j;
  string str;
  
  getline(cin,str);
  for(i=0;i<26;i++){
    str=change(str);
    for(j=0;j+3<(int)str.size();j++)
      if(str.substr(j,3)=="the")break;
    for(j=0;j+4<(int)str.size();j++)
      if(str.substr(j,4)=="this")break;
    for(j=0;j+4<(int)str.size();j++)
      if(str.substr(j,4)=="that")break;
  }
  cout<<str<<endl;

  
  return 0;
}

C++: //
// Created by Tian Wang on 16/4/3.
//
#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool ascii_diff(string x1, string x2) {
    int len = x1.size();
    bool flag = true;
    for(int i = 1; i < len; i++) {
        int diff1 = (int)x1[i] - (int)x1[i-1];
        int diff2 = (int)x2[i] - (int)x2[i-1];
        if(diff1 != diff2) {
            flag = false;
        }
    }
    return flag;
}

int main() {
    string str1 = "the";
    string str2 = "this";
    string str3 = "that";
    string x;
    int len, len_whole;
    int diff=0;
    string word;
    int word_len;
    int sent_len;
    int ascii;
    char k;
    vector<string> input;

    for(string line; getline(cin, line);) {
        len_whole = line.size();
        string x1;
        for(int i = 0; i < len_whole; i++) {
            k = line[i];

            if((int)k >= 97 & (int)k <=122) {
                x1.push_back(k);
            }
            else {
                input.push_back(x1);
                x1.clear();
                x1.push_back(k);
                input.push_back(x1);
                x1.clear();
            }
        }
        x1.clear();
        sent_len = input.size();
        for(int i =0; i < sent_len; i++) {
            x = input[i];
            len = x.size();
            if(len == 3) {
                if(ascii_diff(str1, x)) {
                    diff = (int)x[0] - (int)str1[0];
                }
            }
            else if(len == 4) {
                if(ascii_diff(str2, x)) {
                    diff = (int)x[0] - (int)str2[0];
                }
                else if (ascii_diff(str3, x)) {
                    diff = (int)x[0] - (int)str3[0];
                }
            }
        }
        for(int i = 0; i < sent_len; i++) {
            word = input[i];
            word_len = word.size();
            for(int j = 0; j < word_len; j++) {
                ascii = (int)word[j];
                if(ascii >= 97 & ascii <=122) {
                    cout << (char)(ascii-diff);
                }
                else {
                    cout << (char)ascii;
                }
            }
        }
        cout << endl;
        input.clear();
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
	const string key[] = { "the", "this", "that" };
//	cut here before submit 
//	freopen("testcase.cc", "r", stdin);
	string str = "";
	
	while (getline (cin, str )){
		int len = str.length();
		int i,j;

		for (j = 1; j < 26; ++j){
			string curr = str;
			for (i = 0; i < len; ++i){
				if ( isalpha(curr[i]) ){
					if (isupper(curr[i])){
						curr[i] = (curr[i] - 'A' + j) % 26 + 'A';
					}else if (islower(curr[i])){
						curr[i] = (curr[i] - 'a' + j) % 26 + 'a';
					} // end if
				} // end if
			} // end for
			for (i = 0; i < 3; ++i){
				if ( curr.find(key[i]) != string::npos ){
					cout << curr << endl;
					goto next;
				} // end if
			} // end for
		} // end for
next:
	;
	} // end while
		
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

int main() {
	char s[81] = {};
	while (fgets(s,sizeof(s),stdin)) {
		int start = 0, ofs=0,ofs2,chk=1;
		char buf;
		for (int i = 0; s[i] != '\n'; i++) {
			cout << "start=" << start << endl;
			if (s[i] == ' ' || s[i] == '.') {
				if (i - start == 3) {
					cout << "a\n";
					chk = 1;
					ofs2 = (int)'t' - (int)s[start];
					for (int j = 1; j < 3; j++) {
						buf = s[start + j] + ofs2;
						if (buf > 'z')
							buf -= 26;
						if (buf < 'a')
							buf += 26;
						if (j == 1 && buf != 'h') {
							chk = 0;
							break;
						}
						if (j == 2 && buf != 'e')
							chk = 0;
					}
					if (chk == 1) {
						ofs = ofs2;
						cout << ofs << endl;
						break;
					}
				}
				if (i - start == 4) {
					cout << "b\n";
					chk = 0;
					ofs2 = (int)'t' - (int)s[start];
					for (int j = 1; j < 3; j++) {
						buf = s[start + j] + ofs2;
						if (buf < 'z')
							buf -= 26;
						if (buf > 'a')
							buf += 26;
						if (j == 1 && buf != 'h') {
							chk = 0;
							break;
						}
						if (j == 2 && buf == 'a')
							chk = 2;
						if (j == 2 && buf == 'i')
							chk = 3;
						if (j == 2 && buf != 'i'&&buf != 'i') {
							chk = 0;
							break;
						}
						if (j == 3 && chk == 2) {
							if (buf == 't')
								chk = 1;
							else {
								chk = 0;
								break;
							}
						}
						if (j == 3 && chk == 3) {
							if (buf == 's')
								chk = 1;
							else {
								chk = 0;
								break;
							}
						}
					}
					if (chk == 1) {
						ofs = ofs2;
						cout << ofs << endl;
						break;
					}
				}
				start = i + 1;
			}
		}
		for (int i = 0; s[i] != '\n'; i++) {
			if (s[i] != ' '&& s[i]!='.') {
				s[i] += ofs;
				if (s[i] > 'z')
					s[i] -= 26;
				if (s[i] < 'a')
					s[i] += 26;
			}
		}
		cout << s;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main(void) {

  string str;
   
  while(getline(cin, str)) {
    while(1) {
      for(int i=0; i<str.length(); i++) {
          if(str[i] != ' ' && str[i] != '.') {
              if(str[i] != 'z'){
                        str[i] += 1;
                    }else{
                        str[i] = 'a';
                    }
          }
      }
      

          if(str.find("the")!=string::npos||str.find("this")!=string::npos||str.find("that")!=string::npos) {
          cout << str << endl;
          break;
      
    }
    }
  }
  return 0;
}