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 <cstdio>
#include <cstring>
#include <map>
using namespace std;

const int msg_size = 80;
const char int2alp[26] = {
	'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
	'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
	'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
	'y', 'z'
};

typedef map<char, int> myMap;
myMap alp2int;

int get_length(char *data) {
	for (int i = 0;; i++) {
		if (data[i] == '\0') {
			return i;
		}
	}
}

bool is_match(char *data) {
	for (int i = 0; i < 81; i++) {
		if (data[i] == 't' && data[i+1] == 'h') {
			if (data[i+2] == 'e') {
				return true;
			}
			else if (data[i+2] == 'i' && data[i+3] == 's'){
				return true;
			}
			else if (data[i+2] == 'a' && data[i+3] == 't') {
				return true;
			}
		}
	}
	return false;
}

bool gen_caesar(char *data, int size, int length) {
	char prev[100], back[100];
	prev[length] = back[length] ='\0';
	for (int i = 0; i < length; i++) {
		if (data[i] == ' ' || data[i] == '.' || data[i] == '\n') {
			prev[i] = data[i];
			back[i] = data[i];
		}
		else {
			prev[i] = int2alp[(alp2int[data[i]]+size) % 26];
			back[i] = int2alp[(alp2int[data[i]] >= size) ? alp2int[data[i]]-size : 26-(size-alp2int[data[i]])];
		}
	}
	if (is_match(prev)) {
		printf("%s", prev);
		return true;
	}
	if (is_match(back)) {
		printf("%s", back);
		return true;
	}
	return false;
}

void init_alp2int() {
	alp2int.insert(myMap::value_type('a', 0));
	alp2int.insert(myMap::value_type('b', 1));
	alp2int.insert(myMap::value_type('c', 2));
	alp2int.insert(myMap::value_type('d', 3));
	alp2int.insert(myMap::value_type('e', 4));
	alp2int.insert(myMap::value_type('f', 5));
	alp2int.insert(myMap::value_type('g', 6));
	alp2int.insert(myMap::value_type('h', 7));
	alp2int.insert(myMap::value_type('i', 8));
	alp2int.insert(myMap::value_type('j', 9));
	alp2int.insert(myMap::value_type('k', 10));
	alp2int.insert(myMap::value_type('l', 11));
	alp2int.insert(myMap::value_type('m', 12));
	alp2int.insert(myMap::value_type('n', 13));
	alp2int.insert(myMap::value_type('o', 14));
	alp2int.insert(myMap::value_type('p', 15));
	alp2int.insert(myMap::value_type('q', 16));
	alp2int.insert(myMap::value_type('r', 17));
	alp2int.insert(myMap::value_type('s', 18));
	alp2int.insert(myMap::value_type('t', 19));
	alp2int.insert(myMap::value_type('u', 20));
	alp2int.insert(myMap::value_type('v', 21));
	alp2int.insert(myMap::value_type('w', 22));
	alp2int.insert(myMap::value_type('x', 23));
	alp2int.insert(myMap::value_type('y', 24));
	alp2int.insert(myMap::value_type('z', 25));
}

int main(int argc, char *argv[]) {
	init_alp2int();
	char rcv[100];
	
	while(NULL != fgets(rcv, 80, stdin)) {
		int length = get_length(rcv);
	
		for (int i = 0; i < 26; i++) {
			if (gen_caesar(rcv, i, length)) {
				break;
			}
		}
	}
	return 0;
}

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

using namespace std;

char data[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char trans[100];
char mozi;
int position=0;
int zoom;
int first_check=0,first_position=0;
int now;
char result;

int main(){
	while(scanf("%c",&mozi) != EOF){
		for(int i=0;i<26 && first_check == 0;i++){
			if(mozi == data[i]){
				first_position = i;
				zoom = first_position - 19;
				first_check = 1;
			}
		}




		if(mozi == ' ' || mozi == '.' || mozi == '\n'){
			trans[position] = mozi;
			position++;

			if(mozi == '\n'){
				printf("%s",trans);
				first_check = 0;
				position = 0;
				memset(trans,'\0',sizeof(trans));
			}
		}else{
			for(int i=0;i<26;i++){
				if(data[i] == mozi){
					now = i;
					break;
				}
			}

			trans[position] = data[now - zoom];
			position++;

		}
	}
}

C++: #include<iostream>
#include<vector>
#include<string>

std::string Caesar(std::string str, int tranceNum )
{
	for(size_t i=0; i<str.length(); ++i)
	{
		if(str[i]!='.')
		{
			int chNum = 0;
	
			chNum = str[i];

			chNum += tranceNum;

			chNum = (chNum-97)%26+97;
	
			str[i] = chNum;	
		
		}
	}

	return str;
}

int main(void)
{
	std::string str;
	
	std::vector<std::string> sentence;

	while(!(std::cin.eof()))
	{
	
		while(std::cin >> str)
		{
			sentence.push_back(str);
				
			if(sentence[sentence.size()-1][sentence[sentence.size()-1].length()-1]=='.')
			{
				break;
			}
		}	

		for(bool flg=1; flg; )
		{
			for(size_t j=0; j<sentence.size(); ++j)
			{
			sentence[j] = Caesar(sentence[j],1);	
			}
	
			for(size_t j=0; (j<sentence.size()) && flg; ++j)
			{
				switch(sentence[j].length())
				{
				case 3:
					flg = (sentence[j]=="the") ? 0 : 1;
					break;
				case 4:
					flg = (sentence[j]=="that" || sentence[j]=="this") ? 0 : 1;
					break;
				case 5:
					flg = (sentence[j]=="that." || sentence[j]=="this.") ? 0 : 1;
					break;
				default:
					break;
				}
			}
		}
		for(size_t j=0; j<sentence.size(); ++j)
		{
			std::cout << sentence[j] << ' ';
		}
		std::cout << '\n';
	
		sentence.clear();
		}
}

C++: #include <bits/stdc++.h>
using namespace std;
string word[3] = {"this","that","the"};
int main(){
  char c;
  string s[80];
  int smax = 0;
  while(cin >> c){
    if(c == '\n' || c == ' '){
      smax++;s[smax] += c;
      smax++;
    }else{
      s[smax] += c;
    }
  }
  cout << smax << endl;
  bool flag = false;
  while(1){
    for(int i = 0;i < smax;i++){
      for(int j = 0;j < s[i].size();j++){
	if(isalpha(s[i][j])){
	  s[i][j]++;
	  if(s[i][j] == 'z' + 1)s[i][j] = 'a';
	}
	for(int j = 0;j < 3;j++){
	  if(word[j] == s[i]){flag = true;break;}
	}for(int j = 0;j < 3;j++){
	  if(word[j] + '.' == s[i]){flag = true;break;}
	}
	if(flag)break;
      }
      if(flag)break;
    }
    if(flag)break;
  }
  for(int i = 0;i < smax;i++)cout << s[i];
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main()
{
	string key;
	
	while (getline(cin, key)) {

		for (int j = 0; j < 26; j++) {
			for (int i = 0; i < key.size(); i++) {
				if (key[i] >= 'a' && key[i] <= 'z') {
					key[i] = (key[i] == 'z') ? 'a' : key[i] + 1;
				}
			}

			if (key.find("the") != string::npos || key.find("this") != string::npos || key.find("that") != string::npos)
				cout << key;
		}
	}
	return 0;
}