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 <vector>
#include <algorithm>
#include <regex>
#include <cctype>
#include <string>
#include <utility>
using namespace std;

vector<string> v;

vector<string> split(string&& s, regex&& pattern) {
    sregex_token_iterator first(s.begin(), s.end(), pattern, -1);
    sregex_token_iterator last;
    return(vector<string>(first, last));
}

bool cheser() {
    for(int r = 1; r <= 26; r++) {
        bool found = false;
        for(int c = 0; c < v.size(); c++) {
            for(int k = 0; k < v[c].length(); k++) {
                if(!isalpha(v[c][k])) continue;
                int now = v[c][k] - 'a';
                now = (now+1)%26;
                v[c][k] = 'a' + now;
            }
            if(v[c] == "the" || v[c] == "this" || v[c] == "that") found = true;
        }
        if(found) return(true);
    }
    return(false);
}

int main(void) {
    string input;
    while(getline(cin, input)) {
        v = split(move(input), regex(" "));
        cheser();
        for(int r = 0; r < v.size(); r++) {
            cout << v[r];
            if(r == v.size() - 1) cout << endl;
            else                  cout << " ";
        }
    }
    
    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<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

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

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

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define pb(a) push_back(a)

char in(char data){
  if(data < 'a' || 'z' < data)return data;
  if('z' == data){
    return 'a';
  }else{
    return ++data;
  }
}
int main(void){
  string str;
  vector<string> pa;
  getline(cin,str);
  str+= " ";
  string w;
  for(int i = 0 ; i < str.size() ; i ++){
    if(str[i] == ' '){
      pa.pb(w);
      w="";
    }else{
      w+=str[i];
    }
  }
  string t[3] = {"this","the","that"};
  while(true){
    vector<string> after;
    bool find = false;
    rep(i,pa.size()){
      rep(j,3){
	if(pa[i] == t[j])find = true;
      }
      w = "";
      rep(j,pa[i].size()){
	w += in(pa[i][j]);
      }
      after.pb(w);
    }
    if(find)break;
    pa=after;
  }
  rep(i,pa.size())cout<<pa[i]<<" ";
  cout<<endl;
}

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

int main(){
  string str;
  string word[111];
  string com[3]={"the","this","that"};
  int cou=0;
  while(cin >> str){
    word[cou] = str;
    cou++;
  }

  while(1){
    bool flag = false;
    for(int i=0;i<cou;i++){
      for(int j=0;j<word[i].size();j++){
	if(word[i][j] == 'z'){
	  word[i][j] = 'a';
	}
	else if(word[i][j] >= 'a' && word[i][j] <= 'z'){
	  word[i][j]++;
	}
      }
      for(int j=0;j<3;j++){
	if(word[i] == com[j]){
	  flag = true;
	  break;
	}
      }
    }
    if(flag == true){
      break;
    }
  }
  for(int i=0;i<cou;i++){
    cout << word[i];
    if(i == cou-1) cout << endl;
    else cout << " ";
  }
}

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

int main(void){
	char data[100];
	char s1[]="the",
		 s2[]="this",
		 s3[]="that";
	int i,cnt=0;
	char *p;

	while((fgets(data,100,stdin))){
		while(cnt<26){
			p=strstr(data,s1);
			if(p)
				break;
			p=strstr(data,s2);
			if(p)
				break;
			p=strstr(data,s3);
			if(p)
				break;
			for(i=0;i<100;i++){
				if(data[i]=='\0')
					break;
				if('a'<=data[i] && data[i]<='y')
					data[i]++;
				else if('z'==data[i])
					data[i]='a';
			}
			cnt++;
		}
		cnt=0;
		printf("%s",data);
	}

	return 0;
}

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

int attack(string line)
{
    static const string cmp[3] = {"the", "this", "that"};
    istringstream iss(line);

    for (string word; iss >> word;) {
        char first = word[0];
        for (string c: cmp) {
            int i = 1;
            for (; i < c.size() && i < word.size(); i++)
                if ((c[i] - 't') % 26 != (word[i] - first) % 26)
                    break;
            if (i == c.size()) {
                int div = ('t' - first) % 26;
                return (div >= 0) ? div : 26 + div;
            }
        }
    }

    return 0;
}

inline int rotN(int x, int n)
{
    if (isalpha(x))
        return (x - 'a' + n) % 26 + 'a';
    else
        return x;
}

int main()
{
    int rot;
    string line;

    while (getline(cin, line)) {

        rot = attack(line);

        for (auto x : line)
            cout << (char) rotN(x, rot);

        cout << endl;
    }

    return 0;
}