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

int main(){
	char input[81],str[50][81];
	int pos=0,last_pos=0,i,j,diff;
	const char cmp[3][5]={"that","this","the"};
	bool is_found=false;


	scanf("%[^\n]",input);
	for(i=0;input[i]!='\0';i++){
		if(input[i]==' ' || input[i]=='.'){
			for(j=last_pos;j<i;j++){
				str[pos][j]=input[j];
			}
			str[pos][j]='\0';
			pos++;
			last_pos=i+1;
		}
	}

	for(i=0;i<pos;i++){
		for(j=0;j<4;j++){
			diff=str[i][0]-cmp[j][0];
			for(int k=1;str[i][k]!='\0';k++){
				str[i][k]-=diff;
			}
			if(strcmp(str[i],cmp[j])){
				j=4;i=pos;
				is_found=true;
			}
		}
	}

	for(i=0;input[i]!='\0';i++){
		if(input[i]!='.' && input[i]!=' '){
			input[i]-=diff;
		}
	}

	printf("%s\n",input);

	return 0;
}

C++: #include <cstdio>
#include <cstring>
using namespace std;
char The[][26] = { "the","uif","vjg","wkh","xli","ymj","znk","aol","bpm","cqn","dro","esp","ftq","gur","hvs","iwt","jxu","kyv","lzw","max","nby","ocz","pda","qeb","rfc","sgd" };
char This[][26] = { "this","uijt","vjku","wklv","xlmw","ymnx","znoy","aopz","bpqa","cqrb","drsc","estd","ftue","guvf","hvwg","iwxh","jxyi","kyzj","lzak","mabl","nbcm","ocdn","pdeo","qefp","rfgq","sghr" };
char That[][26] = { "that","uibu","vjcv","wkdw","xlex","ymfy","zngz","aoha","bpib","cqjc","drkd","esle","ftmf","gung","hvoh","iwpi","jxqj","kyrk","lzsl","matm","nbun","ocvo","pdwp","qexq","rfyr","sgzs" };
char buf[128], tmp[128];
int main()
{
	while (fgets(buf, 128, stdin)) {
		strcpy(tmp, buf);
		int k = 0;
		bool found = false;
		char* p = strtok(buf, " ");
		while (p) {
			if (!found) for (int i = 0; i < 26; ++i)  {
				if (!strcmp(p, The[i]) || !strcmp(p, This[i]) || !strcmp(p, That[i])) {
					found = true;
					k = i;
					break;
				}
			}
			p = strtok(NULL, " ");
		}
		for (int i = 0; tmp[i]; ++i) {
			if ('a' <= tmp[i] && tmp[i] <= 'z')
				putchar((tmp[i] - 'a' - k + 26) % 26 + 'a');
			else
				putchar(tmp[i]);
		}
	}
	return 0;
}

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

int main(){
    string str;
    
    while(getline(cin,str)){
        int flg = 0;
        
        while(true){
            for(int i = 0 ; i < str.length() ; i++){
                string key1 = str.substr(i,3),key2 = str.substr(i,4);
                if(key1 == "the" || key2 == "that" || key2 == "this") flg = 1;
            }
            
            if(flg) goto end;
            else{
                for(int j = 0 ; j < str.length() ; j++){
                    if('a' <= str[j] && str[j] <= 'z'){
                        str[j] -= 'a' - 'A';
                        str[j] = (char)('A'+(str[j]-'A'+26+1)%26);
                        str[j] += 'a' - 'A';
                    }
                    else continue;
                }
            }
        }
    end:
    cout << str << endl;
    }
        
    return 0;
}

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

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

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

bool isSmallAlphabet(char& ch) {
  /* a ~ z(ascii) : 97 ~ 122 */
  if('a' <= ch && ch <= 'z') return true;
  else return false;
}

bool isHit(string& str) {
  if(str.find("the") != str.npos) return true;
  else if(str.find("this") != str.npos) return true;
  else if(str.find("that") != str.npos) return true;
  else return false;
}

/* ????????¶??????????§£??? */
void CaesarCipher(string& _str) {
  
  /* parameter??????????????¢??????????????????????????????????????? */
  for(int parameter = 0; parameter < 26; ++parameter) {
    string str = _str;
    for(int i = 0; i < (int)str.length(); ++i) {
      
      /* ?°?????????¢??????????????????????????? */
      if(isSmallAlphabet(str[i])) {
        str[i] += parameter;
        /* ???????????????????°?????????§???????????£??????*/
        if(!isSmallAlphabet(str[i])) {
          str[i] -= 26;
        }
      }

    }

    /* Find "the" or "this" or "that" */
    if(isHit(str)) {
      cout << str << endl;
    }
  }
}

int main() {
  string str;
  while(getline(cin, str)) {
    CaesarCipher(str);
  }
  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;
}