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++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <algorithm>

using namespace std;

const char *azaz= "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
const char *az = azaz + 26;

inline bool is_sep(char *c) {
    return *c == ' ' || *c == '.' || *c == '\n';
}

inline bool is_alpha(char *c) {
    return 'a' <= *c && *c <= 'z';
}

inline char _rotate(char c, char df) {
    int d = c - 'a' + df;
    return *(az + d);
}

inline char rotate(char c, char df){
    if(is_alpha(&c)){
        c = _rotate(c, df);
    }
    return c;
}

inline char decode_from_t(char t, char tgt){
    int df = ('t' - t);
    return _rotate(tgt, df);
}

char buf[82];



inline int df(char *l, int next){
    return *(l+next) - *(l + 1 + next);
}

inline int df(char l, char r){
    return l - r;
}

// return rot.
int findTheThatThis(){
    char *f_sep, *b_sep = buf - 1, *f = buf;;
    char d_the[][2] = { {-14, 3},{12, -23},{12, 3} }; // the
    char d_this_that[][3] = {
        {-14, -1, -10}, {-14, -1, 16}, {-14, 25, -10}, {12, -1, -10}, // this
        {-14, 7, 7}, {12, -19, 7}, {12, 7, -19}, // that
    };
    bool found = false;

    do {
        if(!is_alpha(f) && *f != '\n'){
            f++;
        }
        if(*f == '\n')break;
        f_sep = f - 1;

        while (!is_sep(++b_sep));
        //for_each(f_sep, b_sep, [](char x){ putchar(x); }); putchar('\n');
        if(b_sep - f_sep - 1== 3){
            int buf[2] = { df(f_sep,1), df(f_sep,2) };
            for (int i = 0; i < sizeof(d_the); i++) {
                if(d_the[i][0] == buf[0] && d_the[i][1] == buf[1]){
                    found = true;
                    break;
                }
            }
        }else if(b_sep - f_sep - 1 == 4){
            int buf[3] = { df(f_sep,1), df(f_sep,2), df(f_sep,3)};
            for (int i = 0; i < sizeof(d_this_that); i++) {
                if(d_this_that[i][0] == buf[0] && d_this_that[i][1] == buf[1] && 
                        d_this_that[i][2] == buf[2]){
                    found = true;
                    break;
                }
            }
        }
        if(found) return 't' - *(f_sep+1);
        f = b_sep;
    } while (1);

    // not found
    return 0;
}

int main(int argc, char const* argv[])
{
    int dif;

    while (nullptr != fgets(buf, 82, stdin)) {
        dif = findTheThatThis();
        for (int i = 0; ; i++) {
            if(buf[i] == '\n'){
                buf[i] = '\0';
                puts(buf);
                break;
            }
            buf[i] = rotate(buf[i], dif);
        }
    }
  
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

string shift(string s, int k) {
  string res = "";
  for (int i = 0; i < s.size(); i++) {
    if ('a' <= s[i] && s[i] <= 'z') {
      s[i] = (s[i] - 'a' + k) % 26 + 'a';
    }
    res += s[i];
  }
  return res;
}

int main(void) {
  string s;
  while (getline(cin, s)) {
    string w;
    for (int i = 0; i < 26; i++) {
      w = shift(s, i);
      if (w.find("the") != string::npos || w.find("this") != string::npos || w.find("that") != string::npos) {
        cout << w << endl;
        break;
      }
    }
  }

  return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;

string s;

int main(){
	while(getline(cin,s)){
		rep(i,s.size()){
			if(s[i]>='a'&&s[i]<='z'){
				s[i]-='a';
			}
			else if(s[i]==13){
				s[i]=200;
			}
		}
		for(int i=0;;i++){
			bool f=false;
			rep(j,s.size()-3){
				if(s[j]=='t'-'a'&&s[j+1]=='h'-'a'&&((s[j+2]==0&&s[j+3]=='t'-'a')||(s[j+2]=='i'-'a'&&s[j+3]=='t'-'a')||s[j+2]=='e'-'a')){
					f=true;
					break;
				}
			}
			if(f) break;
			else{
				rep(j,s.size()){
					if(s[j]<='z'-'a'&&s[j]>=0){
						s[j]=(s[j]+1)%('z'-'a'+1);
					}
				}
			}
		}
		rep(i,s.size()){
			if(s[i]<='z'-'a'&&s[i]>=0){
				s[i]+='a';
			}
			else if(s[i]==200){
				s[i]=13;
			}
		}
		cout<<s<<endl;
			
	}
	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#define N 100
using namespace std;

void hukugou(char str2[]){
  int i;

  while(1){

    for(i = 0;str2[i] != '\0';i++){
      if(str2[i] != ' ' && str2[i] != '\n'){
	str2[i] = (str2[i] - 'a' + 1) % 26 + 'a';
      }
    }

    if(strstr(str2, "the") != NULL || strstr(str2, "this") != NULL || strstr(str2, "that") != NULL){
      cout << str2;
      break;
    }
  }

}

int main(){
  char str[N];

  fgets(str, sizeof(str), stdin);

  hukugou(str);

  return 0;
}

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

int main(){
	char s[81],os[81];
	int i,j;
	while(1){
	if(gets(s)==NULL)return 0;
	int len=strlen(s);
	for(j=0;j<len;j++)os[j]=s[j];
	os[len]='\0';
	for(j=0;j<26;j++){
		for(i=0;i<len;i++){
			if(s[i]>='a'&&s[i]<='z'){
				s[i]-=j;
				if(s[i]<'a')s[i]+=('z'-'a');
			}
		}
		if(strstr(s,"this")!=NULL||strstr(s,"the")!=NULL||strstr(s,"that")!=NULL){
			goto end;
		}
		for(i=0;i<len;i++)s[i]=os[i];
	}
end:
	for(i=0;i<len;i++){
		if(os[i]>='a'&&os[i]<='z'){
			os[i]-=j;
			if(os[i]<'a')os[i]+=('z'-'a');
		}
	}
	printf("%s\n",os);
	}
}

C++: #include <stdio.h>

int main(void)
{
	char str[80];
	int num, num2;
	int i;
	
	while (fgets(str, 80, stdin) != NULL){
		num = 't' - str[0];
		i = 0;
		while (str[i] != '\0'){
			if (str[i] != '.' && str[i] != ' ' && str[i] != '\n'){
				str[i] += num;
				if (str[i] > 'z'){
					num2 = str[i] - 'z';
					str[i] = num2 + 'a';
				}
				else if (str[i] < 'a'){
					num2 = 'a' - str[i];
					str[i] = 'z' - num2;
				}
			}
			i++;
		}
		printf("%s", str);
	}
	
	printf("\n");
	
	return (0);
}