Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		var result string
		line := scanner.Text()
		key := make(map[string]string)

		var i int32
		for ; i < 52; i++ {
			makeKey(key, i)
			result = decode(key, line)

			if strings.Contains(result, "the") {
				break
			} else if strings.Contains(result, "this") {
				break
			} else if strings.Contains(result, "that") {
				break
			}
		}

		fmt.Println(result)
	}
}

func makeKey(key map[string]string, shift int32) {
	for i := 'a'; i <= 'z'; i++ {
		cipher := (i + shift)
		if cipher > 'z' {
			cipher = cipher%'z' + 'a' - 1
		} else if cipher < 'a' {
			cipher = cipher + ('z' - 'a') + 1
		}
		key[string(i)] = string(cipher)
	}
}

func decode(key map[string]string, cipher string) string {
	var result string
	for _, v := range cipher {
		if key[string(v)] != "" {
			result += key[string(v)]
		} else {
			result += string(v)
		}
	}
	return result
}

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;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int ans=-1,len=0;
  string s;
  getline(cin,s);
  while(len<27){
    ans = s.find("the");
    if(ans!=-1)break;
    ans = s.find("this");
    if(ans!=-1)break;
    ans = s.find("that");
    if(ans!=-1)break;
    for(int i=0;i<s.size();i++){
      if(s[i]=='z') s[i]='a';
      else if(s[i]>='a' && s[i]<'z') s[i]++;
    }
    len++;
  }
  cout << s << endl;
}