Go: package main

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

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 len(infos) == 0 {
			break
		}
		// 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 <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;
}

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

int main(void){
	vector<string> v;
	string str;

	while(cin>>str){
		v.push_back(str);
	}

	for(int cif=0;cif!=26;cif++){
		for(int i=0;i<v.size();i++){
			for(int j=0;j<v[i].length();j++){
				if('A'<=v[i][j]&&v[i][j]<='Z'){
					v[i][j]=(v[i][j]-'A'+cif)%26+'A';
				}else if('a'<=v[i][j]&&v[i][j]<='z'){
					v[i][j]=(v[i][j]-'a'+cif)%26+'a';
				}
			}
		}
		for(int i=0;i<v.size();i++){
			if(v[i]=="that" || v[i]=="the"||v[i]=="this"){
				for(int k=0;k<v.size();k++){
					if(k!=v.size()-1)cout<<v[k]<<" ";
					else cout<<v[k];
				}
				exit(0);
			}
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){ 
  char a;
  while(cin>>a){
    if(a==' '||a=='.'||a=='\n')cout<<a;
     else 
       for(int i=0;i<26;i++){
	 if((char)(a+i)=="that"||(char)(a+i)=="this"||(char)(a+i)=="the") {
	  cout<<(char)(a+i);
	  break;
	  }
	i++;
	}
    cout<<endl;
  }
    return 0;
  }

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



char slide(char ch, int dif) {
  if( ! isalpha(ch) ) return ch;

  int n = ch - 'a';
  n = (n + dif ) % 26;
  return 'a' + n;
}

int main() {
  string line; getline(cin, line);
  
  for(int dif = 0; dif < 26; dif++) {
    string str = line;
    
    for(int i = 0; i < (int)str.size(); i++) 
      str[i] = slide( str[i], dif);

    if( str.find("the") != string::npos ||
        str.find("this") != string::npos ||
        str.find("that") != string::npos ) {
      cout << str << endl;
      break;
    }
  }
    
}