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 <iostream>
#include <cstring>
using namespace std;

int main(){
	string str[100];
	int k = 0;
	int zure[100];
	bool flag[100] = {false};
	while(getline(cin, str[k])){
		for(int j = 0; j < 26; j++){
			for(int i = 0; i < str[k].size()-2; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'e'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			for(int i = 0; i < str[k].size()-3; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'i'+j && str[k][i+3] == 's'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
			for(int i = 0; i < str[k].size()-3; i++){
				if(str[k][i] == 't'+j && str[k][i+1] == 'h'+j && str[k][i+2] == 'a'+j && str[k][i+3] == 't'+j){
					zure[k] = j;
					flag[k] = true;
					break;
				}
			}
			if(flag[k] == true){
				k++;
				break;
			}
		}
		k++;
	}
	for(int j = 0; j < k; j++){
		for(int i = 0; i < str[j].size(); i++){
			if(str[j][i] >= 'a' && str[j][i] <= 'z'){
				str[j][i] = str[j][i]-zure[j];
				if(str[j][i] < 'a'){
					str[j][i] = str[j][i]+26;
				}
				cout << str[j][i];
			}
			else{
				cout << str[j][i];
			}
		}
	}
}

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

using namespace std;

int main(){
  string s;
  while(getline(cin,s)){
    for(int i=1;i<26;i++){
      string ans;
      for(string::iterator it=s.begin();it!=s.end();it++){      
	if(*it==' '||*it=='.'){
	  ans.push_back(*it);
	  continue;
	}
	ans.push_back((char)(((int)*it-0x61+i)%26+0x61));
      }
      if(ans.find("the")!=string::npos||ans.find("this")!=string::npos||ans.find("that")!=string::npos){
	cout<<ans<<endl;
	break;
      }
    }
  }
  return 0;
}

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

struct words {
	char str[82] ;
} w[82] ;

int p ;
int key ;
char c ;

bool isalpha ( char s ) ;

int main ( )
{
	p = 0 ;
	key = 9999 ;
	while ( true ) {
		int t = scanf ( "%s" , w[p].str ) ;
		if ( t == EOF ) {
			break ;
		}
		c = getchar ( ) ;
		if ( strlen ( w[p].str ) == 4 && key == 9999 ) {
			if ( w[p].str[0] - w[p].str[1] == 't' - 'h' && w[p].str[1] - w[p].str[2] == 'h' - 'i' && w[p].str[2] - w[p].str[3] == 'i' - 's' ) {
				key = 't' - w[p].str[0] ;
			}
			else if ( w[p].str[0] - w[p].str[1] == 't' - 'h' && w[p].str[1] - w[p].str[2] == 'h' - 'a' && w[p].str[2] - w[p].str[3] == 'a' - 't' ) {
				key = 't' - w[p].str[0] ;
			}
		}
		else if ( strlen ( w[p].str ) == 3 && key == 9999 ) {
			if ( w[p].str[0] - w[p].str[1] == 't' - 'h' && w[p].str[1] - w[p].str[2] == 'h' - 'e' ) {
				key = 't' - w[p].str[0] ;
			}
		}
		p++ ;
		if ( c == '\n' ) {
			for ( int i = 0 ; i < p ; i++ ) {
				for ( int j = 0 ; w[i].str[j] ; j++ ) {
					if ( isalpha ( w[i].str[j] ) ) {
						w[i].str[j] += key ;
						if ( w[i].str[j] - 'a' > 26 ) {
							w[i].str[j] -= 26 ;
						}
						else if ( w[i].str[j] - 'a' < 0 ) {
							w[i].str[j] += 26 ;
						}
					}
				}
				if ( i != 0 ) {
					printf ( " " ) ;
				}
				printf ( "%s" , w[i].str ) ;
			}
			printf ( "\n" ) ;
			p = 0 ;
			key = 9999 ;
		}
	}
	return 0 ;
}

bool isalpha ( char s )
{
	return ( s >= 'a' && s <= 'z' ) ;
}

C++: #include <bits/stdc++.h>
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define RFOR(i,a,b) for(ll i=b-1;i>=a;i--)
#define rsort(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll mod=1000000007;

signed main(){
    string s;
    while (getline(cin, s)) {
        for(int j=0 ; j<26 ; j++){
            for(int i=0 ; i<s.size() ; i++){
                if(s[i]>='a' && s[i]<='z' ) s[i] = (s[i]=='z')? 'a' : s[i] + 1;
            }
            if( s.find( "the" ) != string::npos || s.find( "this" ) != string::npos || s.find( "that" ) != string::npos){
                cout << s << endl;
            }
        }
    }
}

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

int main(void){
  int len, cnt;
  string str(" "), buf;

  getline( cin, buf );
  if( buf[buf.size()-1] == '\n' )
    buf.erase(buf.size()-1);
  if( buf[buf.size()-1] == '\r' )
    buf.erase(buf.size()-1);
  
  str.append(buf);
  str.append(" ");
  len = str.length();
  cnt = 0;

  while(true){
    if( str.find("the", 0) != string::npos
	|| str.find("this", 0) != string::npos 
	|| str.find("that", 0) != string::npos
	)
      break;
    for(int i = 0; i < len; i++){
      if( 'a' <= str[i] && str[i] <= 'z' ){
	str[i]++;
	if(str[i] > 'z')
	  str[i] = 'a';
      }
    }

    cnt++;
    if(cnt > 30)
      break;
  }
  
  str.erase(0,1);
  str.erase(str.size() - 1);
  cout << str;

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[53]="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
int main(){
    char str[82];
    for(int i=0;i<82;i++)str[i]=0;
    for(int i=0;i<80;i++){
        str[i]=getchar();
        if(str[i]==10)break;
    }
    int len=strlen(str);
  
    for(int i=0;i<=26;i++){
        char cpy[81];
        strncpy(cpy,str,81);

        for(int j=0;j<len;j++){
            if(str[j]==' ' || str[j]=='.' || str[j]==10)continue;
            cpy[j]=a[cpy[j]-'a'+i];
        }
        bool f=false;
        for(int j=0;j<len-3;j++){
            if(!strncmp(cpy+j,"the",3))f=true;
            if(!strncmp(cpy+j,"this",4))f=true;
            if(!strncmp(cpy+j,"that",4))f=true;
        }
        if(f){
            cout<<cpy<<endl;
            break;
        }
    }
    return 0;


}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
using namespace std;
int main(){
	
	char s[1000];
	while(cin.getline(s,1000)){
		for(int i=0;s[i]!='\0';i++){
			if((s[i]-s[i+1]=='t'-'h')&&(((s[i+1]-s[i+2]=='h'-'i')&&(s[i+2]-s[i+3]=='i'-'s'))||(s[i+1]-s[i+2]=='h'-'e')||((s[i+1]-s[i+2]=='h'-'a')&&(s[i+2]-s[i+3]=='a'-'t')))){
				for(int j=0;s[j]!='\0';j++){
					if((s[j]!=' ')&&(s[j]!='.')){
						if((s[j]+'t'-s[i]-'a')%24<0){
							putchar('z'+(s[j]+'t'-s[i]+1-'a')%24);
						}else{
							putchar((s[j]+'t'-s[i]-'a')%24+'a');
						}
					}else{
						putchar(s[j]);
					}
				}cout<<endl;
				break;
			}
		}
	}
	return 0;
}