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>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#define INF 1000000000

using namespace std;

// the this that

int main() {
	string str;
	while (getline(cin, str)) {
	  string tmp = "";
	  int len = 0, key;
	  for (int i=0; i<str.length(); i++) {
	    if (str[i] == ' ' && len == 4) {
	      if (tmp[0]-'t'==tmp[1]-'h'&&tmp[1]-'h'==tmp[2]-'i'&&tmp[2]-'i'==tmp[3]-'s') {
		key = tmp[0]-'t';
		break;
	      } else if (tmp[0]-'t'==tmp[1]-'h'&&tmp[1]-'h'==tmp[2]-'a'&&tmp[2]-'a'==tmp[3]-'t') {
		key = tmp[0]-'t';
		break;
	      }
	      tmp = ""; len = 0;
	    } else if (str[i] == ' ' && len == 3) {
	      if (tmp[0]-'t'==tmp[1]-'h'&&tmp[1]-'h'==tmp[2]-'e') {
		key = tmp[0]-'t';
		break;
	      }
	      tmp = ""; len = 0;
	    } else {
	      tmp += str[i];
	      len++;
	    }
	  }
	  for (int i=0; i<str.length(); i++) {
	    if (isalpha(str[i])) {
	      str[i] -= key;
	      if (str[i]>'z') str[i] -= 48;
	      else if (str[i]<'a') str[i] += 48;
	    }
	  }
	  cout << str << endl;
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(int argc, const char * argv[])
{
    string word;
    //string test = "this";
    //string test2 = "the";
    //string test3 = "that";
    int i;
    while (getline(cin, word)) {
        while (1) {
            for (i = 0; i < word.size(); i++) {
                if (isalpha(word[i])) {
                    word[i]++;
                    if (word[i] == '{') {
                        word[i] = 'a';
                    }
                }
            }
            if (word.find("this") != -1 || word.find("that") != -1 || word.find("the") != -1) {
                break;
            }
        }
        cout << word << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#include <sstream>
#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  string str;
  while (getline(cin, str)) {
    istringstream is(str);
    string token;
    int n;
    while (is >> token) {
      for (int i = 0; i < 26; i++) {
	string tmp;
	for (int j = 0; j < token.size(); j++) {
	  tmp += (token[j] - 'a' + i) % 26 + 'a';
	}
	//cout << "i = " << i << "tmp = " << tmp << endl;
	if (tmp == "the" || tmp == "this" || tmp == "that") {
	  n = i;
	  goto next;
	}
      }
    }
  next:
    //printf("n = %d\n", n);
    for (int i = 0; i < str.size(); i++) {
      printf("%c", ('a' <= str[i] && str[i] <= 'z') ?(str[i] - 'a' + n) % 26 + 'a' : str[i]);
    }
    printf("\n");
  }
}

C++: #include<cstdio>
#include<cctype>
#include<cstring>
using namespace std;
int main(){
    int f = 0;
    while(1){
        char str[100] = {0};
        scanf("%[^\n]s",str);
        if(str[0] == EOF){
            getchar();
            break;
        }
        for(int i = 0;i <= 25; i++){
            for(int j = 0;j < strlen(str); j++){
                if(str[j] == '\n' || str[j] == '.')continue;
                str[j] += 1;
                }
                for(int k = 0;k < strlen(str); k++){
                    if(str[k] == 't' &&  str[k+1] == 'h' && str[k+2] == 'e')goto hoge;
                    if(str[k] == 't' &&  str[k+1] == 'h' && str[k+2] == 'i' && str[k+3] == 's')goto hoge;
                    if(str[k] == 't' &&  str[k+1] == 'h' && str[k+2] == 'a' && str[k+3] == 't')goto hoge;
            }
        }
        for(int i = 0;i < strlen(str); i++){
            if(str[i] == '\n' || str[i] == '.')continue;
            str[i] -= 25;
        }

        for(int i = 0;i <= 25; i++){
            for(int j = 0; j< strlen(str); j++){
                if(str[j] == '\n' || str[j] == '.')continue;
                str[j] -= 1;
            }
            for(int k = 0;k < strlen(str); k++){
                    if(str[k] == 't' &&  str[k+1] == 'h' && str[k+2] == 'e')goto hoge;
                    if(str[k] == 't' &&  str[k+1] == 'h' && str[k+2] == 'i' && str[k+3] == 's')goto hoge;
                    if(str[k] == 't' &&  str[k+1] == 'h' && str[k+2] == 'a' && str[k+3] == 't')goto hoge;
            }
        }

        hoge:

        for(int i = 0;i < strlen(str)-1; i++)if(str[i] == 46)str[i] = ' ';
        printf("%s\n",str);
        //for(int i = 0;i < strlen(str); i++)str[i] = 0;
        getchar();
    }
    return 0;
}

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 = 't' - w.front();
	for_each(w.begin(),w.end(),[sh](char &c) {
		c += sh;
		if (c > 'z') {
			c -= (char)26;
		} else if (c < 'a') {
			c += (char)26;
		}
	});
	if (w != "the" && 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) {
			while (w.front() == '.') {
				w.erase(0,1);
			}
			while (w.back() == '.') {
				w.pop_back();
			}
			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 -= (char)26;
				} else if (c < 'a') {
					c += (char)26;
				}
			}
		});
		cout << s << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

string rotate(string S, int a){
  for(int i=0; i<S.length(); i++){
    if(S[i] != ' ' && S[i] !=  '.'){
      S[i] = (S[i] -'a' + a) % 26 + 'a';
    }
  }
  return S;
}





int main(){
  string S;
  
  while(getline(cin, S)){
    for(int i=0; i<26; i++){
      string T = rotate(S, i); bool flag = false;

      for(int j=0; j<S.length(); j++){
        if(T[j] == 't' && T[j+1] == 'h' && T[j+2] == 'e'){
          cout << T << endl; flag = true; break;
        } else if (T[j] == 't' && T[j+1] == 'h' && T[j+2] == 'i' && T[j+3] == 's'){
          cout << T << endl; flag = true; break;
        } else if (T[j] == 't' && T[j+1] == 'h' && T[j+2] == 'a' && T[j+3] == 't'){
          cout << T << endl; flag = true; break;
        }
      }

      if (flag) break;
    }
  }
}