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 <string>
using namespace std;
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string str;
	getline(cin, str);
	
	while(1){
		for(size_t i = 0; i < str.size(); ++i){
			if('A' <= str[i] && str[i] <= 'Z'){
				if(str[i] == 'Z'){
					str[i] = 'A';
				}
				else {
					str[i]++;
				}
			}
			if('a' <= str[i] && str[i] <= 'z'){
				if(str[i] == 'z'){
					str[i] = 'a';
				}
				else {
					str[i]++;
				}
			}
		}
		bool check = false;
		for(size_t i = 0; i < str.size(); ++i){
			if(str[i] == 't'){
				if(str.substr(i, 3) == "the" || str.substr(i, 4) == "this" || str.substr(i, 4) == "that"){
					check = true;
					break;
				}
			}
		}
		if(check){
			break;
		}
	}
	cout << str << endl;
	
	return 0;
}

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

int main(){
    char THIS[] = "this";
    char THE[] = "the";
    char THAT[] = "that";
    
    while(feof(stdin) == 0){
        char str[81];
        fgets(str,80,stdin);
        if(str[0] == 0) break;
        
        int str_cnt = 0;
        int z = 0;
        while(str_cnt < strlen(str)){
            char key[10];
            int offset;
            sscanf(&str[str_cnt],"%s ",key);
            str_cnt += strlen(key) + 1;
            
            switch(strlen(key)){
            case 3:
                offset = THE[0] - key[0];
                if(THE[1] - key[1] == offset && THE[2] - key[2] == offset){
                    z = offset;
                    str_cnt = 999999;
                    break;
                }
                break;
            case 4:
                offset = THIS[0] - key[0];
                if(THIS[1] - key[1] == offset && THIS[2] - key[2] == offset && THIS[3] - key[3] == offset){
                    z = offset;
                    str_cnt = 999999;
                    break;
                }
                if(THAT[1] - key[1] == offset && THAT[2] - key[2] == offset && THAT[3] - key[3] == offset){
                    z = offset;
                    str_cnt = 999999;
                    break;
                }
                break;
            }
        }
        //z *= -1;
        for(int i = 0;i < strlen(str);i++){
            if(str[i] != ' ' && str[i] != '.') printf("%c",str[i]+z);
            else                               printf("%c",str[i]); 
        }
        printf("\n");
    }
}

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

// determine whether it is "the","this" or "that"
char is_article(string w) {
	char sh = '\0'; // shift defaults to 0
	if (w.size() == 3) {
		sh = 't' - w.front();
		for_each(w.begin(),w.end(),[sh](char &c) {
			c += sh;
			if (c > 'z') {
				c -= 'z'-'a'+1;
			} else if (c < 'a') {
				c += 'z'-'a'+1;
			}
		});
		if (w != "the") {
			sh = '\0';
		}
	} else if (w.size() == 4) {
		sh = 't' - w.front();
		for_each(w.begin(),w.end(),[sh](char &c) {
			c += sh;
			if (c > 'z') {
				c -= 'z'-'a'+1;
			} else if (c < 'a') {
				c += 'z'-'a'+1;
			}
		});
		if (w != "this" && w != "that") {
			sh = '\0';
		}
	}
	return sh;
}

int main() {
	string s;
	while (getline(cin,s)) {
		istringstream stream(s);
		string w;
		char sh;
		while (stream >> w) {
			if ((sh = is_article(w)) != '\0') {
				break;
			}
		}
		for_each(s.begin(),s.end(),[sh](char &c) {
			if (c >= 'a' && c <= 'z') {
				c += sh;
				if (c > 'z') {
					c -= 'z'-'a'+1;
				} else if (c < 'a') {
					c += 'z'-'a'+1;
				}
			}
		});
		cout << s << endl;
	}
}

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

int CheckDiff(string);
int ShowSourceString(string,int);
int main(){
	string str;
	while(getline(cin,str)){
		ShowSourceString(str,CheckDiff(str));
	}
	
	return 0;
}

int CheckDiff(string str){
	for( int i=0;i<(int)str.length();i++ ){
		if( (abs(str[i+1]-str[i])==abs('h'-'t'))&& 
		    (abs(str[i+2]-str[i])==abs('a'-'t'))&&
		    (abs(str[i+3]-str[i])==abs('t'-'t'))
		){
			return str[i]-'t';
		}
		if( (abs(str[i+1]-str[i])==abs('h'-'t'))&& 
		    (abs(str[i+2]-str[i])==abs('i'-'t'))&&
		    (abs(str[i+3]-str[i])==abs('s'-'t'))
		){
			return str[i]-'t';
		}
		if( (abs(str[i+1]-str[i])==abs('h'-'t'))&& 
		    (abs(str[i+2]-str[i])==abs('e'-'t'))
		){
			return str[i]-'t';
		}
	}
	return 0;
}
int ShowSourceString(string str,int diff){
	for( int i=0;i<(int)str.length();i++ ){
		if('a'<=str[i]&&str[i]<='z' ){
			if(str[i]-diff>'z'){
				cout<<(char)('a'+str[i]-diff-'z'-1);			
			}else if(str[i]-diff<'a'){
				cout<<(char)('z'-('a'-(str[i]-diff))+1);			
			}else{
				cout<<(char)(str[i]-diff);
			}
		}else{
			cout<<(char)str[i];
		}
	}
	cout<<endl;
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main() {
	string str;
	while(getline(cin, str)) {
		int n = 't' - str[0];
		for(int i = 0; str[i] != '\0'; i++) {
			if(('a' <= str[i])&&(str[i] <= 'z')) {
				str[i] += n;
				if(str[i] > 'z') {
					str[i] = str[i] - 26;
				} else if(str[i] < 'a') {
					str[i] = str[i] + 26;
				}
			}
		}
		cout << str << endl;
	}
	return 0;
}

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

int main(void){
	char list[26];
	list[0]='a';
	for(int i=1;i<26;i++)
		list[i]=list[i-1]+1;
	string S;
	while(true){
		getline(cin,S);
		if(cin.eof())
			break;
		for(int i=0;i<26;i++){
			for(string ::iterator it=S.begin() ;it!=S.end();it++)
				if(islower(*it))
					*it=list[(*it-'a'+1)%26];
			if(S.find("this")!=-1||S.find("that")!=-1||S.find("the")!=-1)
				break;
		}
		cout << S <<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
vector<string> split(string &s, char delimiter){
  vector<string> res;
  int prev_split_point = 0;
  for (int i = 0; i < s.length(); i++) {
    while(s[i] != delimiter && i < s.length())i++;
    string add = s.substr(prev_split_point, i - prev_split_point);
    if(!add.empty())res.push_back(add);
    prev_split_point = i + 1;
  }
  return res;
}

int main(int argc, char *argv[]){
  char c[26];
  for (int i = 0; i < 26; i++) {
    c[i] = 'a' + i;
  }
  vector<string> vs;
  string s;
  string ans[] = {"this", "that", "the"};
  vector<string> tmp;
  while(getline(cin, s)){
    vs = split(s, ' ');
    int n = vs.size();
    vs[n - 1] = vs[n - 1].substr(0, vs[n - 1].length() - 1);
    for (int k = 0; k < 26; k++) {
      tmp = vs;
      for (int i = 0; i < vs.size(); i++) {
        for (int j = 0; j < vs[i].length(); j++) {
          tmp[i][j] = c[(vs[i][j] - 'a' + k) % 25];
        }
      }
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < tmp.size(); j++) {
          if(tmp[j] == ans[i]){k = 50, i = 10, j = 1000;}
        }
      }
    }
    for (int i = 0; i < tmp.size(); i++) {
      std::cout << tmp[i];
      if(i == tmp.size() - 1)std::cout << "." << std::endl;
      else std::cout << " ";
    }
  }
  return 0;
}