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 <string>
using namespace std;
int main( void )
{
  string s;
  while( 1 ){
    getline( cin, s );
    if( cin.eof() ) break;
    while( 1 ){
      for( int i=0; i<s.size(); i++ ){
        if( s[i] == 'z' ) s[i] = 'a';
        else if( 'a' <= s[i] && s[i] < 'z' ) s[i]++;
      }
      if( s.find( "the",  0 ) != string::npos ){ cout << s << endl; break; }
      if( s.find( "this", 0 ) != string::npos ){ cout << s << endl; break; }
      if( s.find( "that", 0 ) != string::npos ){ cout << s << endl; break; }
    }
  }
  return 0;
}

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

int find_cnt;
string find_str;

bool find(string str, string can) {
  string tmp_can = ' ' + can + ' ';
  string tmp_str = ' ' + str + ' ';
  int cnt = 0;
  for (int i = 0; i < tmp_str.length(); ++i) {
    if (string::npos != tmp_str.find(tmp_can, i)) {
      cnt++;
    }
  }
  if (find_cnt < cnt) {
    find_cnt = cnt;
    find_str = str;
  }
  return false;
}

int main() {
  string str;
  string candies[] = {"this", "the", "that"};
  while(getline(cin, str)) {
    find_cnt = 0;
    find_str = "";
  for (int m = 1; m < 26; ++m) {
    for (int i = 0; i < str.length(); ++i) {
      if (str[i] == ' ') {
        continue;
      }
      if (str[i] == ',' || str[i] == '.') {
        str[i] = ' ';
        continue;
      }
      if (m != 1) {
        int char_id = static_cast<int>(str[i]) - 97;
        int shifted = static_cast<int>(char_id + 1);
        str[i] = static_cast<char>(shifted % 26 + 97);
      }
    }
    for (int i = 0; i < sizeof(candies) / sizeof(candies[0]); ++i) {
      find(str, candies[i]);
    }
  }
  if (find_str != "") { 
    cout << find_str << endl;
  }
  }
  return 0;
}

C++: #include <stdio.h>

int main(){
		int i=0;
		int j=0;
		char str[100];
		char s;
		int solved = 0;

		do{
			scanf("%c",&s);
			str[i]=s;
			i++;
		}while(s!='\n');
		str[i]='\0';
//		printf("\ninput: %s\n",str);
		i=0;
		do{
			while(str[i] != '\0'){
					if(str[i]!=' ' && str[i]!='.'){
							str[i]=str[i]-1;
					}
					i++;
			}
//			printf(" try: %s\n",str);
			for(j=0;j<i-4;j++){
			if(j==0 || str[j-1]==' '){
					if(str[j]=='t' && str[j+1]=='h'){
//							printf("  -> ok ");
							if(str[j+2]=='e'){
//								printf("ok ");
								if(str[j+3]=='\0'||str[j+3]==' '){
//									printf("ok \n");
									solved = 1;
									break;
								}
							}else if(str[j+2]=='i' && str[j+3]=='s'){
//								printf("ok ");
								if(str[j+4]=='\0'||str[j+4]==' '){
//									printf("ok \n");
									solved = 1;
									break;
								}
							}else if(str[j+2]=='a' && str[j+3]=='t'){
//								printf("ok ");
								if(str[j+4]=='\0'||str[j+4]==' '){
//									printf("ok \n");
									solved = 1;
									break;
								}
							}
					}
			}
			}
			i=0;
		}while(str[0]>='a' && solved==0);
		if(solved==0){
//				printf("\n<< false >>\n\n");
		}else{
//				printf("\nsolved >> \"%s\"\n\n",str);
				printf("%s",str);
		}

		return 0;
};

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    int in;
    char S[100];
    vector<string> vec;
    
    for(int i=0;;i++){
        
        in = getchar();
        
        if(in<0){
            S[i]='\0';
            break;
        }else{
            S[i]=(char)in;
        }
    }
    
    for(int k=0;k<26;k++){
        
        bool f = false;
        
        for(int i=0;S[i]!='\0';i++){
            if('a'<=S[i] && S[i]<='y'){
                S[i]++;
            }else if(S[i]=='z'){
                S[i]='a';
            }
            
            if(i>=2){
                if(S[i-2]=='t' && S[i-1]=='h' && S[i]=='e')
                    f=true;
            }
            if(i>=3){
                if(S[i-3]=='t' && S[i-2]=='h')
                    if((S[i-1]=='i' && S[i]=='s') || (S[i-1]=='h' && S[i]=='t'))
                    f=true;
            }
        }
        
        if(f) break;
    }
    
    for(int i=0;S[i]!='\0';i++)
        printf("%c",S[i]);
    
    return 0;
}

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

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

bool isvalid(string s) {
    for(int i=0; i<=s.length()-4; ++i) {
        string ss = s.substr(i,4);
        if(ss == "this" || ss == "that") return true;
    }
    for(int i=0; i<=s.length()-3; ++i) {
        string ss = s.substr(i,3);
        if(ss == "the") return true;
    }
}

int main() {
    string s;
    while(getline(cin,s)) {
        for(int i=0; i<=25; ++i) {
            s = decy(s,1);
            //cout<<s<<endl;
            if(isvalid(s)) {
                cout<<s<<endl;
                break;
            }
        }
    }
}

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

using namespace std;

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

C++: #include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

bool includes_keyword(const char *str) {
  const static char *keywords[] = { "the", "this", "that" };
  for (const auto keyword : keywords) {
    const char *pos = strstr(str, keyword);
    if (pos == NULL) { continue; }
    if (pos != str && isalpha(pos[-1])) { continue; }
    if (isalpha(pos[strlen(keyword)])) { continue; }
    return true;
  }
  return false;
}

int main() {
  char *cipher = NULL;
  size_t buffer_size = 0;
  ssize_t len;
  while ((len = getline(&cipher, &buffer_size, stdin)) > 0) {
    if (cipher[len - 1] == '\n') {
      cipher[len - 1] = '\0';
      len -= 1;
    }

    char c = 'z';
    for (int i = 0; i < len; ++i) {
      if (isalpha(cipher[i]) && c > cipher[i]) { c = cipher[i]; }
    }
    int shift_begin = 'a' - c;
    int shift_end = shift_begin + 26;
    char decoded[81];
    for (int shift = shift_begin; shift < shift_end; ++shift) {
      strcpy(decoded, cipher);
      for (int i = 0; i < len; ++i) {
        if (isalpha(decoded[i])) { decoded[i] += shift; }
      }
      if (includes_keyword(decoded)) {
        puts(decoded);
        break;
      }
    }
  }

  free(cipher);

  return 0;
}