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<iostream>
#include<string>
#include<cctype>
using namespace std;
string cea (string a){
  for(int i=0;i<a.length();i++){
    if(isalpha(a[i])) a[i]=(char)a[i]+1;
    if(a[i]=='{')a[i]='a';
  }
    return a;
}

string cear(string b,int c){
  for(int i=0;i<c;i++){
    b=cea(b);
  }
  return b;
}


int main(){
  string input[100];
  string in;
  int n=0;
  int ans=0;
  while(cin>>in){
    // if(in=="00")break;
    input[n]=in;
    n++;
    
  }
  for(int i=0;i<30;i++){
    for(int j=0;j<n;j++){
      in=cear(input[j],i);
      if(in=="the"||in=="this"||in=="that"){ans=i;}
    }
  }
  for(int i=0;i<n-1;i++){
    cout<<cear(input[i],ans)<<' ';
  }
  cout<<cear(input[n-1],ans)<<endl;
  //  cout<<ans<<endl;

}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#define pi 3.14159
using namespace std;

int main() {
	string str;
	int i;
	while(getline(cin, str)) {
		for(i = 0; i < 26; i++) {
			for(int j = 0; j < str.size(); j++) {
				if(str[j] != ' ' && str[j] != '.') {
					if(str[j] != 'a') {
						str[j] -= 1;
					} else str[j] = 'z';
					cout << str <<endl;
				}
			}
			for(int j = 0; j < str.size() - 4; j++) {
				if(str[j] == 't' && str[j + 1] == 'h') {
					cout << str <<endl;
					i = 26;
					break;
				}
			}
			
		}
	}

	return 0;
}

C++: /* 
シーザー暗号文の解読
cout << str[i] + 1;
とすると文字が出力されないので注意。配列を書き換えて文字コードをずらす。
*/

#include <iostream>
#include <cstring>
using namespace std;

int main(void) {
    string str;
    int size;
    int f = string::npos;
    
    while(getline(cin, str)) {
        size = str.size();
        while(str.find("the") == f && str.find("this") == f && str.find("that") == f) {
            for(int i = 0; i < size; ++i) {
                if('a' <= str[i] && str[i] < 'z') {
                    str[i]++;
                } else if(str[i] == 'z') {
                    str[i] = 'a';
                }
            }
        }
        cout << str << endl;
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>

#define int64 long long int

using namespace std;

char * caesar(char *);

int main()
{
	int i, c;
	char str[128];
	
	while(1){
		for(i=0; ; i++){
			c = getchar();
			if(c == '\n' || c == EOF) break;
			str[i] = c;
		}
		str[i] = 0;
		cout << caesar(str) << '\n';

		if(c == EOF) break;
	}

	return 0;
}

char * caesar(char *str){
	int len, i;
	len = strlen(str);
	while(1){
		for(i=0; i<len; i++){
			if(str[i] >= 'b' && str[i] <= 'z')
				str[i]--;
			else if(str[i] == 'a')
				str[i] = 'z';
		}
		for(i=0; i<len; i++){
			if(str[i] == 't' && str[i+1] == 'h'){
				if(str[i+2] == 'e' ||
					(str[i+2] == 'i' && str[i+3] == 's') ||
					(str[i+2] == 'a' && str[i+3] == 't'))
					return str;
			}
		}
	}
	return 0;
}

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

typedef unsigned long long ull;
const ull B = 100000007;

using namespace std;

bool contain(string,string);

int main(void){
  string str;
  while(getline(cin,str)){
   
    while(1){
	int fg=0;
      for(int j=0;j<26;j++){
	for(int i=0;i<str.length();i++)
	  if(isalpha(str[i]))str[i] = (str[i]=='z')? 'a' : str[i] + 1;

	if(contain("that",str)||contain("the",str)||contain("this",str)){
	  cout << str << endl;
	  fg=1;
	  break;
	}
      }
      if(fg)break;
    }
  }
  return 0;
}

bool contain(string a,string b){
  int al=a.length(),bl=b.length();
  if(al>bl)return false;

  ull t=1;
  for(int i=0;i<al;i++)t*=B;

  ull ah=0,bh=0;
  for(int i=0;i<al;i++)ah=ah*B+a[i];
  for(int i=0;i<al;i++)bh=bh*B+b[i];

  for(int i=0;i+al<=bl;i++){
    if(ah==bh)return true;
    if(i+al<bl) bh=bh*B+b[i+al]-b[i]*t;
  }
  return false;
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	char s[81];
	int l;
	while(*gets(s)!='\0'){
		l=strlen(s);
		while(strstr(s,"the")==NULL && strstr(s,"that")==NULL && strstr(s,"this")==NULL){
			rep(i,l){
				if(in(s[i],'a','z')){
					s[i]++;
					if(s[i]>'z')s[i]-=26;
				}
			}
		}
		puts(s);
	}
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<memory>
#include<array>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>

using namespace std;

int chipher( string& s )
{
  for ( auto& c : s )
    {
      if ( c >= 'a' && c <= 'y' )
        ++c;
      else if ( c == 'z' )
        c = 'a';
    }
  return 0;
}

int main()
{
  
  string x;

  while( getline(cin, x) )
    {
      for ( int i = 0; i < 26; ++i )
        {
          if ( x.find( "the" ) != string::npos )
            cout << x << endl;
          else if ( x.find( "this" ) != string::npos )
            cout << x << endl;
          else if ( x.find( "that" ) != string::npos )
            cout << x << endl;
          chipher( x );
        }
    }
  
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define GETSTR(p)       do{ fgets((p), sizeof(p), stdin); } while(0)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0;            } while(0)

int main(void){
    char buf[100];
    GETSTR(buf);
    CHOMP(buf);
    int len = strlen(buf);

    const int nn = 'z' - 'a' + 1;

    while(1){
        for(int i = 0; i < len; i++){
            if(isalpha(buf[i])){
                buf[i] = 'a' + (buf[i] - 'a' + nn - 1) % nn;
            }
        }
        char buf2[100];
        sprintf(buf2, " %s ", buf);
        int l = strlen(buf2);
        for(int i = 0; i < l; i++){
            if(! isalpha(buf2[i])) buf2[i] = ' ';
        }
        if(strstr(buf2, " the ") != NULL) break;
        if(strstr(buf2, " this ") != NULL) break;
        if(strstr(buf2, " that ") != NULL) break;
    }
    puts(buf);

    return 0;
}