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

typedef pair<string, string> P;

P next_word(string sentence) {
  if (sentence.empty()) return make_pair(string(""), string(""));
  if (sentence[0] == ' ' || sentence[0] == '.') {
    return make_pair("", sentence.substr(1));
  } else {
    P recur = next_word(sentence.substr(1));
    return make_pair(sentence[0] + recur.first, recur.second);
  }
}

bool acceptable(string sentence) {
  P p = next_word(sentence);

  while (! p.first.empty() ) {
    if (p.first == "this" || p.first == "the" || p.first == "that")
      return true;

    p = next_word(p.second);
  }
  return false;
}

char slip(char c) {
  if (c < 'a' || 'z' < c) return c;
  
  string alphabet = "abcdefghijklmnopqrstuvwxyza";
  int index = (int)(c - 'a');
  return alphabet[index + 1];
}

char slip(char c, int n) {
  for (int i = 0; i < n; i++)
    c = slip(c);

  return c;
}

string slip(string code, int n) {
  string val;
  for (int i = 0, len = code.length(); i < len; i++)
    val += slip(code[i], n);

  return val;
}

string decode(string code) {
  for (int i = 1; i < 27; i++) {
    string sentence = slip(code, i);
    if (acceptable(sentence))
      return sentence;
  }

  return "";
}

int main() {
  string code;
  while ( getline(cin, code) )
    cout << decode(code) << endl;
}

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

  //  string x;
  char x[100];
  gets(x);
  //  cin >> x;
  bool is = true;
  if(strlen(x) >= 3){
    for(int i = 0; i < 26 ; 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] == ' ') x[j] = ' ';
	else if(x[j] == '\n') x[j] = '\n';
	else 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 <string>
#include <algorithm>

using namespace std;

void shiftchar(char& ch)
{
	if (isalpha(ch)) {
		if (ch == 'z') {
			ch = 'a';
		} else {
			ch = ch + 1;
		}
	}
}

int main()
{
	string input;
	while (getline(cin, input)) {

		string decoded = input;
		for (int i = 0; i < 26; ++i) {
			for_each(decoded.begin(), decoded.end(), shiftchar);
			if (decoded.find("the") != string::npos ||
				decoded.find("this") != string::npos ||
				decoded.find("that") != string::npos) {
				break;
			}
		}

		cout << decoded;
	}

	return 0;
}

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

string in;
vector<string> V;

string change(string in){
  for(int i = 0; i < in.length(); i++){
    if(in[i] != 'a') in[i]--;
    else in[i] = 'z';
  }
  return in;
}
string solve(){
  int status = 0;
  while(1){
    for(int i = 0; i < V.size(); i++){
      string str = V[i];
      if(str != "." && str != " ") V[i] = change(str);
      if(V[i] == "the" || V[i] == "this" || V[i] == "that") status = 1;
    }
    if(status)break;
  }
  string out;
  for(int i = 0; i < V.size(); i++){
    out += V[i];
  }
  return out;
}
int main(){
  while(getline(cin,in)){
    V.clear();
    in += "\n";
    string str;
    for(int i = 0; i < in.length(); i++){
      if(in[i] < 'a' || in[i] > 'z'){
	V.push_back(str);
	str = "";
	if(in[i] == '.') V.push_back(".");
	if(in[i] == ' ') V.push_back(" ");
      }else str += in[i];
    }
    cout << solve() << endl;
  }
  return 0;
}

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

int main(void) {
  string t[3] = {"the", "this", "that"};
  string str;
  
  while(getline(cin, str)) {
    while(1) {
      for(int i=0; i<str.length(); i++) if(str[i] != ' ' && str[i] != '.') str[i] = (str[i]-'a' + 1)%26 + 'a';
      for(int i=0; i<3; i++) if(str.find(t[i])!=string::npos) goto fi;
    }
  fi:
    cout << str << endl;
  }
  return 0;
}

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

char* Rest(char *before, char lag);

int main(void)
{
	char before[1000];
	
	scanf("%[^\n]", before);
	
	if (before[0] == 't'){
		printf("%s\n", before);
	}
	else if (before[0] < 't'){
		printf("%s\n", Rest(before, 't' - before[0]));
	}
	else if (before[0] > 't'){
		printf("%s\n", Rest(before, before[0] - 't'));
	}
	
	return (0);
}

char* Rest(char *before, char lag)
{
	int i;
	char ans[1000];
	for (i = 0; before[i] != '\0'; i++){
		
		if (before[i] >= 'a' && before[i] <= 'z' ||
			before[i] >= 'A' && before[i] <= 'Z'){
			
			if (before[i] - lag < 'a'){
				ans[i] = before[i] - lag + 26;
			}
			else if (before[i] - lag > 'z'){
				ans[i] = before[i] - lag - 26;
			}
			else {
				ans[i] = before[i] - lag;
			}
		}
		else {
			ans[i] = before[i];
		}
	}
	ans[i] = '\0';
	
	return (ans);
}