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 <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000

using namespace std;
typedef long long ll;

string change(string s){
    int len=s.size();
    for(int i=0;i<len;i++){
        if('b'<=s[i] && s[i]<='z')s[i]--;
        if(s[i]=='a')s[i]='z';
    }
    return s;
}

bool check(string s){
    int len=s.size();
    string tan="";
    for(int i=0;i<len;i++){
        if('a'<=s[i] && s[i]<='z'){
            tan+=s[i];
        }
        else{
            if(tan=="the" || tan=="this" || tan=="that" )return true;
            tan="";
        }
    }
    return false;
}


int main(){
    string s;
    getline(cin,s);
    while(1){
        s=change(s);
        if(check(s)){cout<<s<<endl;return 0;}
    }
    
    return 0;
}

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

int main() {
	std::string str;
	std::getline(std::cin, str);
	
	std::string ans;
	for (auto c : str) {
		char elem = c - 4;
		if (c >= 'a' && c <= 'z') {
			if (elem < 'a') {
				elem = 'z' - 'a' + elem + 1;
			}
			ans.push_back(elem);
		} else {
			ans.push_back(c);
		}
	}
	
	std::cout << ans << std::endl;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    int in;
    char S[1000];
    
    S[0]=' ';
    
    for(int i=1;;i++){
        
        in = getchar();
        
        if(in==EOF){
            S[i]='\0';
            break;
        }else{
            S[i]=(char)in;
        }
    }
    
    for(int k=0;;k++){
        
        bool f = false;
        
        for(int i=1;S[i]!='\0';i++){
            if('a'<=S[i] && S[i]<='y'){
                S[i]++;
            }else if(S[i]=='z'){
                S[i]='a';
            }
            
            if(i>=3 && (S[i+1]<'a' || 'z'<S[i+1]) && (S[i-3]<'a' || 'z'<S[i-3])){
                if(S[i-2]=='t' && S[i-1]=='h' && S[i]=='e')
                    f=true;
            }
            if(i>=4 && (S[i+1]<'a' || 'z'<S[i+1]) && (S[i-4]<'a' || 'z'<S[i-4])){
                if(S[i-3]=='t' && S[i-2]=='h')
                    if((S[i-1]=='i' && S[i-0]=='s') || (S[i-1]=='a' && S[i-0]=='t'))
                        f=true;
            }
        }
        
        if(f) break;
    }
    
    for(int i=1;S[i]!='\0';i++)
        printf("%c",S[i]);
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

int main(int argc, char const *argv[]) {
  string s;
  while(getline(cin,s)){
    //cout << s << endl;
    string a="abcdefghijklmnopqrstuvwxyz";
    a += a;

    string t="";
    bool end=false;
    int i;
    for(int w=1; w<=25; ++w){
      printf("w=%d\n", w);
      t="";
      int p=0;
      rep(i,s.size()){
        if('a'<=s[i] && s[i]<='z'){
          t+=a[s[i]-'a'+w];
        }
        else{
          t+=s[i];
          string tmp=t.substr(p,i-p);
          //cout << tmp << endl;

          if(tmp=="this" || tmp=="the" || tmp =="that") end=true;

          p=i+1;
        }
      }

      if(end) break;
    }

    std::cout << t << std::endl;
  }
  return 0;
}

C++: import Control.Applicative
import Data.Char (readLitChar)
import Data.List
import System.IO

main = do
  eof <- isEOF
  if eof then return ()
         else do
            dataset <- getLine
            mapM_ putStrLn $ decodeCaesar (escape dataset)
            main

shiftChar :: Int -> Char -> Char
shiftChar n c
    | c == '.' = '.'
    | c == ' ' = ' '
    | c == '\n' = '\n'
    | otherwise = toEnum.(+97).(`mod` 26).(+ n).(subtract 97).fromEnum $ c

shiftString :: Int -> String -> String
shiftString n = map (shiftChar n)

decodeCaesar :: String -> [String]
decodeCaesar str = filter (\s -> ("this" `isInfixOf` s) || ("that" `isInfixOf` s) || ("the" `isInfixOf` s))
    $ map shiftString [1..25] <*> [str]

escape :: String -> String
escape [] = []
escape str = x : escape rest
  where [(x,rest)] = readLitChar str

C++: #include<iostream>

using namespace std;
int main()
{
	char key[100];

	while (cin >> key){

	for (int i = 0; i < sizeof(key); i++)
	{
		//if (key[i] == (int)" ")cout << "space";
		if ((int)key[i] <= 122 && (int)key[i] >= 97)
		key[i] = (int)key[i] - 1;
		if (key[i] == 96)key[i] = 122;
	}
	for (int i = 0; i < sizeof(key); i++)
		cout << key[i];
	}
	return 0;
}

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

using namespace std;

string str;

bool caesar()
{
	bool flag = false;

	for (int i=0; i<(int)str.size() - 2; i++)
	{
		if(str[i] == 't' && str[i+1] == 'h') {
			if(str[i+2] == 'e' && (str[i+3] == ' ' || str[i+3] == '\0' || str[i+3] == '.')) {
				flag = true;
				break;
			}
			if(str[i+2] == 'i' && str[i+3] == 's' && (str[i+4] == ' ' || str[i+4] == '\0' || str[i+4] == '.')) {
				flag = true;
				break;
			}
			if(str[i+2] == 'a' && str[i+3] == 't' && (str[i+4] == ' ' || str[i+4] == '\0' || str[i+4] == '.')) {
				flag = true;
				break;
			}
		}
	}

	return flag;
}


int main()
{
	while(getline(cin, str))
	{
		for (int i=0; i<26; i++)	//0〜25文字ずれるまで繰り返す
		{
			if(caesar()) {
				cout << str << endl;
			}

			//cout << str << endl;	//Debug

			for (int j=0; str[j] != '\0'; j++) {
				if(str[j] != ' ' && str[j] != '.') {
					if(str[j] == 'z') {
						str[j] = 'a';
					}
					else {
						str[j]++;
					}
				}
			}
		}
	}

	return 0;
}