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>
#include<cstring>
int main(){std::string s;while(std::getline(std::cin,s)){char b[81],*p,*c;c=b;strcpy(b,s.c_str());int gap=0;do{p=strtok(c," .\n");if(p!=NULL){int l=strlen(p);if(l>=3&&p[0]-p[1]=='t'-'h'){if(l==3){if(p[0]-p[2]=='t'-'e'){gap='t'-p[0];}}else if(l==4){if(p[0]-p[2]=='t'-'i'&&p[0]-p[3]=='t'-'s'||p[0]-p[2]=='t'-'a'&&p[0]-p[3]==0){gap='t'-p[0];break;}}}}c=NULL;}while(p!=NULL);for(std::string::iterator it=s.begin();it!=s.end();++it){if(*it!=' '&&*it!='.'&&*it!='\n'){std::cout<<static_cast<char>(*it+gap);}else{std::cout<<*it;}}puts("");}}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>

using namespace std;


int main(){
	string line;

	while(getline(cin, line)){
		int flag;

		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<line.size() ; j++){
				if(line[j] != ' ' && line[j] != '.'){
					if((line[j]-1) < 'a'){
						line[j] = line[j] +1 -'a' + 'z' ;
					}else{
						line[j]--;
					}
				}
			}

			for(int k=0 ; k<line.size() ; k++){
				if(line[k] == 'h' && line[k-1] == 't'){
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}
		cout << line << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>

using namespace std;
char encrypt[50];
char decrypt[50];
int count[50];
int j =1;
int key,i;

int main(){
    count[0] = 0;
    while(count[j] = scanf("%[^\r\n]", encrypt),count[j] != count[j-1]){
        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);
        j++;
    }
    return 0;
}

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;
}