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>
using namespace std;

int main()
{
    string Alphabet = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
    string THE[26];
    string THIS[26];
    string THAT[26];
    //Generate THE
    for(int x = 0; x < 26; x++)
    {
        THE[x] = THE[x] + Alphabet[26+x] + Alphabet[26+7-19+x] + Alphabet[26+4-19+x];
    }

    //Generate THIS
    for(int y = 0; y < 26; y++)
    {
        THIS[y] = THIS[y] + Alphabet[26+y] + Alphabet[26+7-19+y] + Alphabet[26+8-19+y] + Alphabet[26+18-19+y];
    }

    //Generate THAT
    for(int z = 0; z < 26; z++)
    {
        THAT[z] = THAT[z] + Alphabet[26+z] + Alphabet[26+7-19+z] + Alphabet[26-19+z] + Alphabet[26+z];
    }




    string Text;
    //Input
    getline(cin,Text);

    int Different = 0;

    //Find THE THIS THAT

    for(int A = 0; A < 26; A++)
    {
        if(Text.find(THE[A]) < Text.length())
        {
            break;
        }
        else if(Text.find(THIS[A]) < Text.length())
        {
            break;
        }
        else if(Text.find(THAT[A]) < Text.length())
        {
            break;
        }
        Different++;
    }


    //Convert Sentence

    for(unsigned int B = 0; B < Text.length(); B++)
    {
        for(int N = 0; N < 26; N++)
        {
            if(Text[B] == Alphabet[N])
            {
                Text[B] = Alphabet[N+Different-1];
                break;
            }

        }
    }

    cout << Text << endl;
}

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

  //  string x;
  char x[100];



  while(gets(x)){
    //  cin >> x;


    bool is = true;
    if(strlen(x) >= 3){
      for(int i = 0; i < 30 ; i++){
	//the 
	for(int j = 0; j <= strlen(x)-3; j++){
	  if(is && x[j] =='t' && x[j+1] == 'h' && x[j+2] == 'e'){
	    is = false;
	    break;
	  }
	}
	// this or that
	if(strlen(x) >= 4){
	  for(int j = 0; j <= strlen(x)-4; j++){
	    if(is && x[j] =='t' && x[j+1] == 'h' && x[j+2] == 'a' && x[j+3] =='t' ){
	      is = false;
	      break;
	    }
	    if(is && x[j] =='t' && x[j+1] == 'h' && x[j+2] == 'i' && x[j+3] =='s' ){
	      is = false;
	      break;
	    }
	  }
	}
	// increment
	if(is == false) break; 
	for(int j = 0; j < strlen(x) ; j++){
	  if(x[j] == 'z') x[j] = 'a';
	  else if(x[j] >= 'a' && x[j] < 'z') x[j]++;
	}
      }
    
      if(is == false)	
	cout << x << endl;
    }
  }
  return 0;
}

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

string inc(string str, int c)
{
    for (int i = 0; i < str.size(); ++i) {
        if (str[i] < 'a' || 'z' < str[i])
            continue;
        int tmp = (str[i] - 'a' + c)%26;
        str[i] = 'a' + tmp;
    }
    return str;
}

int main(void)
{
    bool flag;
    string str;
    getline(cin, str);

    for (int i = 0; i < 26; ++i) {
        flag = false;
        string tmp;
        stringstream ss;
        ss << str;
        while (!ss.eof()) {
            ss >> tmp;
            tmp = inc(tmp, i);
            flag += tmp == "this";
            flag += tmp == "that";
            flag += tmp == "the";
            flag += tmp == "this.";
            flag += tmp == "that.";
            if (flag)
                break;
        }
        if (flag) {
            cout << inc(str, i) << endl;
            break;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <istream>
#include <cstring>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	char a[82], b[82], t;
	
	while(cin.getline(a, 82, '\n')){
		n = strlen(a);
		for(int i = 0, f = 0; i < 26; i++){
			for(int j = 0; j < n; j++){
				if(a[j] == ' ' || a[j] == ',' || a[j] == '.'){
					b[j] = a[j];
				} else {
					t = a[j] - i;
					if(t < 'a'){
						t += 25;
					} else if(t > 'z'){
						t -= 25;
					}
					b[j] = t;
				}
			}
			
			for(int j = 0; j < n; j++){
				if(b[j] == 't' && j == 0 && b[j+1] == 'h'){
					if(b[j+2] == 'e' && b[j+3] == ' '){
						f = 1;
						break;
					} else if(b[j+2] == 'a' && b[j+3] == 't' && b[j+4] == ' '){
						f = 1;
						break;
					} else if(b[j+2] == 'i' && b[j+3] == 's' && b[j+4] == ' '){
						f = 1;
						break;
					}
				} else if(b[j] == ' ' && b[j+1] == 't' && b[j+2] == 'h'){
					if(a[j+3] == 'e' && a[j+4] == ' '){
						f = 1;
						break;
					} else if(b[j+3] == 'a' && b[j+4] == 't' && b[j+5] == ' '){
						f = 1;
						break;
					} else if(b[j+3] == 'i' && b[j+4] == 's' && b[j+5] == ' '){
						f = 1;
						break;
					}
				}
			}
			if(f == 1){
				printf("%s\n", b);
				break;
			}
		}
	}
	
	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) {
	if (w == "the" || w == "this" || w == "that") {
		return '\0';
	}
	char 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" && 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 <cstdio>
#include <vector>

using namespace std;
char encrypt[50];
char decrypt[50];
int key,i;

int main(){
    while(scanf("%[^\r\n]", encrypt) != EOF){
        while(encrypt[i] != '\0'){
            if(encrypt[i] - encrypt[i+1] == 12){
                key = 't' - encrypt[i];
                break;
            }
            i++;
        }

        i = 0;
        while(encrypt[i] != '\0'){
            if(encrypt[i] <= 'z' && encrypt[i] >= 'a'){
                decrypt[i] = (encrypt[i] - 'a' + key) % 26 + 'a';
            }
            else{
                decrypt[i] = encrypt[i];
            }
            i++;
        }
        printf("%s\n", decrypt);
    }
    return 0;
}