Go: package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
	"reflect"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

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 {
		infos := strings.Split(nextString(), " ")
		plain := make([]string, len(infos))
		if reflect.DeepEqual(infos, []string{}) {
			break
		}
		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;

void solve()
{
	string str;
	while(getline(cin, str))
	{
		int n = str.size();
		for(int i = 0; i < 26; ++i)
		{
			string Ans = str;
			for(int j = 0; j < n; ++j)
			{
				if('a' <= Ans[j] && Ans[j] <= 'z')
				{
					if(Ans[j] + i > 'z')
					{
						Ans[j] += i;
						Ans[j] -= 26;
					}
					else
					{
						Ans[j] += i;
					}
				}
			}
			for(int j = 0; j < n; ++j)
			{
				if(Ans[j] == 't')
				{
					if((j + 1 < n && Ans[j + 1] == 'h') && (j + 2 < n && Ans[j + 2] == 'i') && (j + 3 < n && Ans[j + 3] == 's'))
					{
						cout << Ans << endl;
						goto END;
					}
					else if(j + 1 < n && Ans[j + 1] == 'h' && j + 2 < n && Ans[j + 2] == 'a' && j + 3 < n && Ans[j + 3] == 't')
					{
						cout << Ans << endl;
						goto END;
					}
					else if(j + 1 < n && Ans[j + 1] == 'h' && j + 2 < n && Ans[j + 2] == 'e')
					{
						cout << Ans << endl;
						goto END;
					}
				}
			}
		}
	}
END:
	;
}

int main()
{
	solve();
	return(0);
}

C++: #include <stdio.h>
#include <string.h>

char buf[99];

int main(){
    int i;

    for(;~scanf("%[^\n] ",buf);){
        for(i=0; ; i++){
            if( buf[i]-buf[i+1] == 12 ){
                break;
            }
        }
        int sa = buf[i] - 't';
        for(i=0; buf[i]!='\0'; i++){
            buf[i]=!putchar( buf[i] - (97>buf[i] ? 0: sa) );
        }
        puts("");
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#define num 26
using namespace std;

int main(){
	int i;
	string str;
	getline(cin, str);
	string strcp = str;
	string::iterator si;
	for(i=0;i<num;i++){
		if(  strcp.find("this", 0) != string::npos
		  || strcp.find("that", 0) != string::npos
		  || strcp.find("the", 0)  != string::npos){
			break;
		}
		si = strcp.begin();
		while(si != strcp.end()){
			if('a' <= *si && *si <= 'y'){
				*si = *si + char(1);
			}else if(*si == 'z'){
				*si = 'a';
			}
			si++;
		}
	}
	cout << strcp << endl;
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(){
    char a[81];
    int size;
    int i,t;
    fgets(a,81,stdin);
    size = strlen(a);
    for(t=0;t<26;t++){
        for(i=0;i<size;i++)if(isalpha(a[i]))a[i] = 'a'+(a[i]+1-'a')%26;
        for(i=0;i<size;i++){
            if(a[i]=='t'&&a[i+1]=='h'){
                if(a[i+2]=='e'||(a[i+2]=='i'&&a[i+3]=='s')||(a[i+2]=='a'&&a[i+3]=='t')){
                    printf("%s",a);
                    return 0;
                }
            }
        }
    }
}

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

using namespace std;

int dist(int a, int b) {
	int d = b-a;
	if (d >= 26)
		return d-26;
	if (d < 0)
		return d+26;
	return d;
}

int main() {
	char s[81];
	while (cin.getline(s, 81)) {
		int len = strlen(s);
		int shift;
		for (int i = 0; i <= len-4; i++) {
			if (dist(s[i],s[i+1]) != dist('t','h'))
				continue;
			if (
					(dist(s[i+1], s[i+2]) == dist('h','a') && dist(s[i+2],s[i+3]) == dist('a','t')) ||
					(dist(s[i+1], s[i+2]) == dist('h','i') && dist(s[i+2],s[i+3]) == dist('i','s')) ||
					dist(s[i+1], s[i+2]) == dist('h','e'))
				shift = dist(s[i],'t');
		}
		if (
				dist(s[len-3],s[len-2]) == dist('t','h') &&
				dist(s[len-2],s[len-1]) == dist('h','e'))
			shift = dist(s[len-3], 't');
		for (int i = 0; i < len; i++) {
			if (isalpha(s[i]))
				s[i] = (s[i]-'a'+shift)%26+'a';
		}
		cout << s << endl;
	}
	return 0;
}

C++: /*0017 written by iPhone*/
#include <iostream>
#include <string>

using namespace std;

int main(){
    string s;
    while(getline(cin, s) && s != "\0"){
        for(int i = 0; i < s.size(); i++) {
            if(s[i] != " ") s[i]++;
            if(s[i] > 'z' && s[i] != " ") s[i] -= 'z' - 'a';
        }
        if(s.find("the") != -1 || s.find("this") != -1 || s.find("that") != -1 ){
            cout << s;
            return 0;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include<string>
#include<vector>
int main() {
	std::string s;

	while (true) {
		std::getline(std::cin, s);
		if (std::cin.eof()) {
			break;
		}
		std::string a;
		int p = s[0] - 't';
		for (int i = 0; i < s.size(); ++i) {
			if (s[i] != ' ' &&s[i] != '.') {
				if (s[i] - p < 'a') {
					a += 'z' - ('a' - (s[i] - p) - 1);
				}
				else a += s[i] - p;
			}
			else a += s[i];
		}
		std::cout << a << std::endl;
	}	
	return 0;
}

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

int size;
string str;
void change()
{
  for (int i = 0; i < size; i++){
    if ('a' <= str[i] && str[i] <= 'y'){
      str[i]++;
    }
    else if (str[i] == 'z'){
      str[i] = 'a';
    }
  }
}

int main()
{
 // string str;

  getline(cin, str);
  size = str.size();

  for (int i = 0; i < 24; i++){
    change();
    if (str.find("the") != -1 || str.find("this") != -1 || str.find("that") != -1){
      cout << str << endl;
      break;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <ctype.h>
#include <algorithm>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main() {
  string s; 
  while(getline(cin, s)) {
    int slide = 0;
    rep(i, s.size()-4) {
      if(islower(s[i]) == 0) continue;
      rep(j, 26) {
        string sub;
        rep(k, 4) sub += (s[i+k]-'a'+j+52)%26 + 'a';
        if(sub.substr(0,3) == "the") slide = j;
        else if(sub == "this" || sub == "that") slide = j;
      }
      if(slide != 0) break;
    }
    rep(i, s.size()) {
      if(islower(s[i]) != 0)printf("%c", (s[i]-'a'+slide+52)%26 + 'a');
      else cout << s[i];
    }
    cout << endl;
  }
}