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

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

int main() {
  string str;
  string candies[] = {"this", "the", "that"};
  while(getline(cin, str)) {
  for (int m = 0; m < 25; ++m) {
    for (int i = 0; i < str.length(); ++i) {
      if (str[i] == ' ') {
        continue;
      }
      if (str[i] == ',' || str[i] == '.') {
        str[i] = ' ';
        continue;
      }
      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);
    }
    cout << str << endl;
    for (int i = 0; i < sizeof(candies) / sizeof(candies[0]); ++i) {
      if (find(str, candies[i])) {
        cout << "!!!" << endl;
        break;
      }
    }
  }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
string str;	
int a, b, c, d;
int main(){
	while(getline(cin, str)){
		a = str.length();
		for(int i = 0; i < a; i++){
			if(str[i] < 97 || str[i] > 122){
				cout << str[i];
			}
			else {
				b = (int)str[i];
				b = b - 4;
				if(b < 97)
					b = b + 26;
				cout << (char)b;
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int gap = 0;
	string s;
	getline(cin, s);
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 'z' - 'a' + 1; ++j) {
			string cs;
			if (i == 0) cs = "the";
			if (i == 1) cs = "that";
			if (i == 2) cs = "this";
			for (int k = 0; k < cs.length(); ++k) {
				int sum;
				sum = (cs[k] - 'a' + j) % ('z' - 'a' + 1);
				cs[k] = 'a' + sum;
			}
			if (s.find(cs) != string::npos) {
				gap = j;
				break;
			}
		}
		if (gap != 0) break;
	}
	for (int i = 0; i < s.length(); ++i) {
		if ('a' <= s[i] && s[i] <= 'z') {
			int sum;
			sum = (s[i] - 'a' - gap + 'z' - 'a' + 1) % ('z' - 'a' + 1);
			s[i] = sum + 'a';
		}
	}
	cout << s << endl;
	return 0;
}

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

typedef pair<string, string> P;

P next_word(string sentence) {
  if (sentence.empty()) return make_pair(string(""), string(""));
  if (sentence[0] == ' ' || sentence[0] == '.') {
    return make_pair("", sentence.substr(1));
  } else {
    P recur = next_word(sentence.substr(1));
    return make_pair(sentence[0] + recur.first, recur.second);
  }
}

bool acceptable(string sentence) {
  P p = next_word(sentence);

  while (! p.first.empty() ) {
    if (p.first == "this" || p.first == "the" || p.first == "that")
      return true;

    p = next_word(p.second);
  }
  return false;
}

char slip(char c) {
  if (c < 'a' || 'z' < c) return c;
  
  string alphabet = "abcdefghijklmnopqrstuvwxyza";
  int index = (int)(c - 'a');
  return alphabet[index + 1];
}

char slip(char c, int n) {
  for (int i = 0; i < n; i++)
    c = slip(c);

  return c;
}

string slip(string code, int n) {
  string val;
  for (int i = 0, len = code.length(); i < len; i++)
    val += slip(code[i], n);

  return val;
}

string decode(string code) {
  for (int i = 1; i < 27; i++) {
    string sentence = slip(code, i);
    if (acceptable(sentence))
      return sentence;
  }

  return "";
}

int main() {
  string code;
  while ( getline(cin, code) )
    cout << decode(code) << endl;
}

C++: #include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
using std::__gcd;
using std::sort;

void trans(char *s,char *p,int shift){
	for(int i=0;;++i){
		if( isalpha(s[i]) )
			p[i] = (s[i]-'a'+shift)%26 + 'a';
		else p[i] = s[i];
		if( s[i] == 0 ) return;
	}
}

bool check(char *s){
	if( *s != 't' ) return 0;
	++s;
	if( *s != 'h' ) return 0;
	++s;
	if( *s == 'e' ) return 1;
	else if( *s == 'i' && *(s+1) == 's' ) return 1;
	else if( *s == 'a' && *(s+1) == 't' ) return 1;
	return 0;
}

int main(){
	char s[100];
	while( gets(s) ){
		char p[100];
		bool ok = 0;
		for(int i=0;!ok&&i<26;++i){
			trans(s,p,i);
			for(int j=0;!ok&&s[j];++j)
				if(check(p+j)) ok = 1;
		}
		printf("%s\n",p);
	}
	return 0;	
}

C++: a='abcdefghijklmnopqrstuvwxy'
b=input()
for i in range(26):
 c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
 if any(('the 'in c,'this 'in c,'that 'in c)):print(c);break

C++: #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pi acos(-1)
#define MIN(a,b) (a < b ? a : b)
#define MAX(a,b) (a > b ? a : b)
int main()
{
	char s[100],ch;
	int len,i,j,x,y,z,shift,m,c,shift1,shift2,shift3,shift4,shift5,shift6;
	while(gets(s)){
		len=strlen(s);
		c=0;
		for(i=0;i<len;i++){
			if(s[i]>='a'&&s[i]<='z'){
				c++;
			}
			else{
				if(c==3||c==4){
					//printf("c:%d\n",c);
					if(c==3){
						shift1=abs(s[i-3]-'t');
						shift2=abs(s[i-2]-'h');
						shift3=abs(s[i-1]-'e');
						if(shift1==shift2&&shift2==shift3){
							shift='t'-s[i-3];
							printf("%c\n",s[i-3]);
							break;
						}
					}
					if(c==4){
						shift1=abs(s[i-4]-'t');
						//printf("%d %d\n",s[i-3],'t');
						shift2=abs(s[i-3]-'h');
						shift3=abs(s[i-2]-'i');
						shift4=abs(s[i-1]-'s');
						shift5=abs(s[i-2]-'a');
						shift6=abs(s[i-1]-'t');
						//printf("%d %d %d %d %d %d\n",shift1,shift2,shift3,shift4,shift5,shift6);
						if((shift1==shift2&&shift2==shift3&&shift3==shift4)||(shift1==shift2&&shift2==shift5&&shift5==shift6)){
							//printf("%d\n",s[i]);
							shift='t'-s[i-4];
							break;
						}
					}
				}
				c=0;
			}
		}
		//printf("%d\n",shift);
		for(i=0;i<len;i++){
			if(s[i]>='a'&&s[i]<='z'){
				m=s[i]-96;
				//printf("m:%d m+shift:%d\n",m,m+shift);
				if(m+shift>26)s[i]=(m+shift-26)+96;
				else if(m+shift<1)s[i]=96+(26+m+shift);
				else s[i]=96+m+shift;
			}
		}
		for(i=0;i<len;i++){
			printf("%c",s[i]);
		}
		printf("\n");
		memset(s,0,sizeof(s));
	}
	return 0;
}

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

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