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<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#define pi 3.14159
using namespace std;

int main() {
	string str;
	int i;
	while(getline(cin, str)) {
		for(i = 0; i < 26; i++) {
			for(int j = 0; j < str.size(); j++) {
				if(str[j] != ' ' && str[j] != '.') {
					if(str[j] != 'a') {
						str[j] -= 1;
					} else str[j] = 'z';
				}
			}
			for(int j = 0; j < str.size() - 4; j++) {
				if(str[j] == 't' && str[j + 1] == 'h') {
					cout << str <<endl;
					i = 26;
					break;
					//if(str[j + 2] == 'e' ) {
						//cout << str <<endl;
						//i = 26;
						//break;
					//} else if(str[j + 2] == 'i' && str[j + 3] == 's'){
						//cout << str <<endl;
						//i = 26;
						//break;
					//} else if(str[j + 2] == 'a' && str[j + 3] == 't') {
						//cout << str <<endl;
						//i = 26;
						//break;
					//}
				}
			}
			
		}
	}

	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main() {    
    string line;
     
    while (getline(cin,line)) {
        for (int i = 0; i != 26; i++) {
            for (int j = 0; j != line.size(); j++) {
                if (isalpha(line[j])) {
                    line[j] = (line[j] - 'a' + 1) % 26 + 'a';
                }            
            }
            if (line.find("the") != string::npos || line.find("this") != string::npos || line.find("that") != string::npos) {break;}                    
        }
        cout << line << endl;
    }    
    return 0;
}

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

char s1[100];
char s2[100];

int main()
{
	while(1)
	{
		if(NULL == fgets(s1,100,stdin))
		{
			break;
		}
		s1[strlen(s1) - 1] = '\0';
		int l = strlen(s1);
		for(int i = 0; i < 26; i++)
		{
			strcpy(s2,s1);
			for(int j = 0; j < l; j++)
			{
				if('a' <= s2[j] && s2[j] <= 'z')
				{
					int w = s2[j] + i;
					if(w > 'z')
					{
						w -= 26;
					}
					s2[j] = w;
				}
			}
			if(NULL != strstr(s2,"the") || NULL != strstr(s2,"this") || NULL != strstr(s2,"that"))
			{
				printf("%s\n",s2);
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>

#define int64 long long int

using namespace std;

char * caesar(char *);

int main()
{
	int i, c;
	char str[128];
	
	i = 0;
	while((c = getchar()) != EOF){
		if(c != '\n'){
			str[i] = c;
			i++;
		} else {
			str[i] = 0;
			cout << caesar(str) << '\n';
			i = 0;
		}
	}

	return 0;
}

char * caesar(char *str){
	int len, i;
	len = strlen(str);
	while(1){
		for(i=0; i<len; i++){
			if(str[i] >= 'b' && str[i] <= 'z')
				str[i]--;
			else if(str[i] == 'a')
				str[i] = 'z';
		}
		for(i=0; i<len; i++){
			if(str[i] == 't' && str[i+1] == 'h'){
				if(str[i+2] == 'e' ||
					(str[i+2] == 'i' && str[i+3] == 's') ||
					(str[i+2] == 'a' && str[i+3] == 't'))
					return str;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string s;
  int pl=0;
  getline(cin,s);
  for(int i =-30;i<30;i++){
    for(int j = 0; j < s.size(); j++){
      if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'e'&& s[j+3]==' '){
	pl = i;
	break;
      }
      else if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'a' && s[j+3]+i=='t' && s[j+4]==' '){
	pl = i;
	break;
      }
      else if(s[j]+i=='t' &&s[j+1]+i == 'h' && s[j+2]+i == 'i' && s[j+3]+i=='s' && s[j+4]==' '){
	pl = i;
	break;
      }
    }
    if(pl!=0) break;
  }
  for(int i=0;i <s.size();i++){
    if(s[i]<='z' && s[i]>='a') s[i] += pl;
  }
  cout<<s<<endl;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

int main() {
	char s[81] = {};
	while (fgets(s,sizeof(s),stdin)) {
		int start = 0, ofs=0,ofs2,chk=1;
		char buf;
		for (int i = 0; s[i] != '\n'; i++) {
			cout << "start=" << start << endl;
			if (s[i] == ' ' || s[i] == '.') {
				if (i - start == 3) {
					cout << "a\n";
					chk = 1;
					ofs2 = (int)'t' - (int)s[start];
					for (int j = 1; j < 3; j++) {
						buf = s[start + j] + ofs2;
						if (buf > 'z')
							buf -= 26;
						if (buf < 'a')
							buf += 26;
						if (j == 1 && buf != 'h') {
							chk = 0;
							break;
						}
						if (j == 2 && buf != 'e')
							chk = 0;
					}
					if (chk == 1) {
						ofs = ofs2;
						cout << ofs << endl;
						break;
					}
				}
				if (i - start == 4) {
					cout << "b\n";
					chk = 0;
					ofs2 = (int)'t' - (int)s[start];
					for (int j = 1; j < 3; j++) {
						buf = s[start + j] + ofs2;
						if (buf < 'z')
							buf -= 26;
						if (buf > 'a')
							buf += 26;
						if (j == 1 && buf != 'h') {
							chk = 0;
							break;
						}
						if (j == 2 && buf == 'a')
							chk = 2;
						if (j == 2 && buf == 'i')
							chk = 3;
						if (j == 2 && buf != 'i'&&buf != 'i') {
							chk = 0;
							break;
						}
						if (j == 3 && chk == 2) {
							if (buf == 't')
								chk = 1;
							else {
								chk = 0;
								break;
							}
						}
						if (j == 3 && chk == 3) {
							if (buf == 's')
								chk = 1;
							else {
								chk = 0;
								break;
							}
						}
					}
					if (chk == 1) {
						ofs = ofs2;
						cout << ofs << endl;
						break;
					}
				}
				start = i + 1;
			}
		}
		for (int i = 0; s[i] != '\n'; i++) {
			if (s[i] != ' '&& s[i]!='.') {
				s[i] += ofs;
				if (s[i] > 'z')
					s[i] -= 26;
				if (s[i] < 'a')
					s[i] += 26;
			}
		}
		cout << s;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
int main(int argc, const char * argv[])
{
    using namespace std;
    string word;
    int i;
    while (getline(cin, word)) {
        for (i = 0; i < word.length(); i++) {
            if (isalpha(word[i])) {
                word[i] -= 4;
            }
        }
        cout << word << endl;
    }
    return 0;
}

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

int main()
{
	string s;
	while (getline(cin, s))
	{
		string dec = s;
		while (true)
		{
			for (int i = 0; i < dec.size(); i++)
			{
				if ('a' <= dec[i] && dec[i] < 'z') dec[i]++;
				if (dec[i] == 'z') dec[i] = 'a';
			}
			if (dec.find("the") == -1 && dec.find("this") == -1 && dec.find("that") == -1) continue;
			cout << dec << endl;
			break;
		}
	}

	return 0;
}