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<string>
using namespace std;
int main(){
	string b[100];
	int i,j,k,n;
	int s=0;
	while(1){
		i=0;
		s=0;
		while(cin>>b[i]){
			if(b[i][b[i].size()-1]=='.')break;
			i++;
		}
		b[i].erase(b[i].end()-1);
		for(int h=0;h<30;h++){
			for(j=0;j<=i;j++){
				n=b[j].size();
				for(k=0;k<n;k++){
					if(b[j][k]=='a'){
						b[j][k]='z';
					}else{
						b[j][k]--;
					}
				}
			}
			for(j=0;j<=i;j++){
				if(b[j]=="this" || b[j]=="the" || b[j]=="that")s=1;
			}
			if(s==1)break;
		}
		for(j=0;j<=i;j++){
			cout<<b[j];
			if(j!=i)cout<<" ";
		}
		cout<<"."<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,maxe=0,co=0;;
    char str[82][82];
    for(int i=0;;i++){
        cin>>str[i];
        n=strlen(str[i]);
        if(str[i][n-1]=='.'){
                maxe=i+1;
                break;
        }
    }
    for(int i=1;;i++){
        for(int j=0;j<maxe;j++){
            if(str[j][0]-i=='t'){
                if(str[j][1]-i=='h'&&str[j][2]-i=='i'&&str[j][3]-i=='s'||str[j][1]-i=='h'&&str[j][2]=='e'||str[j][1]-i=='h'&&str[j][2]-i=='a'&&str[j][3]=='t'){
                    co=i;
                    break;
                }
            }
        }
        if(co!=0)break;
    }
    for(int i=0;i<maxe;i++){
        for(int j=0;str[i][j]!='\0';j++){
                if(str[i][j]!='.')printf("%c",str[i][j]-co);
                else cout<<".";
        }
        if(i!=maxe-1)cout<<" ";
        else cout<<endl;
    }


}

C++: #define scanf_s scanf
#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
#define ABC 26
int main(void)
{
	int n, s = 0, x, y, r = 0, d;
	char str[MAX];

	while (gets_s(str) != NULL) {
		for (int i = 0; str[i] != '\0'; ++i) {
			if (str[i] - 't' == str[i + 1] - 'h') {
				d = str[i] - 't';
				if ((str[i + 2] - 'a' - d + ABC) % ABC == 'e' - 'a') { break; }
				else if ((str[i + 2] - 'a' - d + ABC) % ABC == 'i' - 'a' && (str[i + 3] - 'a' - d + ABC) % ABC == 's' - 'a') { break; }
				else if ((str[i + 2] - 'a' - d + ABC) % ABC == 'a' - 'a' && (str[i + 3] - 'a' - d + ABC) % ABC == 't' - 'a') { break; }
			}
		}
		for (int i = 0; str[i] != '\0'; ++i) {
			if ('a' <= str[i] && str[i] <= 'z') {
				printf("%c", (str[i] - 'a' - d + ABC) % ABC + 'a');
			}
			else { printf("%c", str[i]); }
		}
		printf("\n");
	}
}

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; getline(cin, s);
  int slide = 0;
  rep(i, s.size()-3) {
    if(islower(s[i]) == 0) continue;
    rep(j, 26) {
      string sub;
      rep(k, 4) sub += (s[i+k]-'0'+j+26)%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]-'0'+slide+26)%26 + 'a');
    else cout << s[i];
  }
  cout << endl;
}

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

using namespace std;

int main()
{
  string stro, str;
  while(getline(cin, stro)){
    for(int i = 0; i < 26; i++){
      str = stro;
      for(int j = 0; j < stro.length(); j++){
	if(str[j] >= 'a' && str[j] <= 'z')
	  if(str[j] + i > 'z')
	    str[j] += i - 26;
	  else
	    str[j] += i;
      }
      std::string::size_type f_the = str.find("the", 0);
      std::string::size_type f_this = str.find("this", 0);
      std::string::size_type f_that = str.find("that", 0);
      if((f_the != string::npos && f_the == 0 && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\0')) || (f_this != string::npos && f_this == 0 && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\0')) || (f_that != string::npos && f_that == 0 && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\0')))
	cout << str << endl;
      else if((f_the != string::npos && (str[(f_the - 1 < 0) ? 0 : f_the - 1] == ' ' || str[(f_the - 1 < 0) ? 0 : f_the - 1] == '.' || str[(f_the - 1 < 0) ? 0 : f_the - 1] == '\n') && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\0')) || (f_this != string::npos && (str[(f_this - 1 < 0) ? 0 : f_this - 1] == ' ' || str[(f_this - 1 < 0) ? 0 : f_this - 1] == '.' || str[(f_this - 1 < 0) ? 0 : f_this - 1] == '\n') && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\0')) || (f_that != string::npos && (str[(f_that - 1 < 0) ? 0 : f_that - 1] == ' ' || str[(f_that - 1 < 0) ? 0 : f_that - 1] == '.' || str[(f_that - 1 < 0) ? 0 : f_that - 1] == '\n') && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\0')))
	cout << str << endl;	 
    }
  }
}