Go: package main

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

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 reflect.DeepEqual(infos, []string{}) {
			break
		}
		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 <stdio.h>
#include <string.h>

void shift(char *str, int len, int n){
	char t[] = "abcdefghijklmnopqrstuvwxyz";
	char c;
	for(int i=0; i<len; ++i){
		c = *(str + i);
		if(c >= 'a' && c <= 'z'){
			str[i] = t[(c-'a'+n)%26];
		}
	}
}

int main(void){
	char input[81];
	char copy[81];
	char *token;
	int len = 0;
	int n = 0;

	while(fgets(input, 80, stdin) != NULL){
		n = -1;
		strcpy(copy, input);

		token = strtok(copy, " .\n");
		while(token != NULL && n == -1){
			len = strlen(token);
			if(len == 4){
				for(int i=0;i<26; ++i){
					shift(token, 4, 1);
					if(strcmp(token, "this")==0 ||
						strcmp(token, "that")==0){
						n = i + 1;
						break;
					}
				}
			}else if(len ==3){
				for(int i=0;i<26; ++i){
					shift(token, 3, 1);
					if(strcmp(token, "the")==0){
						n = i + 1;
						break;
					}
				}
			}
			token = strtok(NULL, " .\n");
		}
		shift(input, strlen(input), n);
		printf(input);
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>

void split(const std::string &s, const char *delims, std::vector<std::string> &v)
{
    std::string::size_type p = 0;
    while (true) {
        std::string::size_type sp = s.find_first_of(delims, p);
        if (sp == std::string::npos) break;
        v.push_back(std::string(s.substr(p, sp - p)));
        p = sp + 1;
    }
}

int search_number(const std::string &s)
{
    std::vector<std::string> v;
    split(s, " ,.", v);

    const char *key = "this";
    for (unsigned i = 0; i < v.size(); ++i) {
        if (v[i].size() == 4) {
            int n = v[i][0] - key[0];
            if (v[i][1] - key[1] == n && v[i][2] - key[2] == n && v[i][3] - key[3] == n) return n;
        }
    }
    return 0;
}

int main()
{
    std::string s;
    while (getline(std::cin, s)) {
        int n = search_number(s);
        for (unsigned i = 0; i < s.size(); ++i) {
            if (s[i] != ' ' && s[i] != ',' && s[i] != '.') {
                s[i] -= n;
                if (s[i] < 'a') s[i] += 26;
                if (s[i] > 'z') s[i] %= 26;
            }
        }
        std::cout << s << std::endl;
    }
}

C++: #include<iostream>
#include<string>
#include<string.h>
using namespace std;
int main()
{
	string s;
	getline(cin, s);
	while (true){
		for (int i = 0; i < s.size(); i++){
			if (s[i] == 'z'){
				s[i] = 'a';
			}
			else if (s[i]>='a'&&s[i] < 'z'){
				s[i]++;
			}
		}
		if (s.find("the") != -1)break;
		if (s.find("this") != -1)break;
		if (s.find("that") != -1)break;
	}
	cout << s << endl;
}

C++: /*0017 written by iPhone*/
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main(){
    string s;
    while(getline(cin, s)){
        for(int i = 0; i < s.size(); i++) s[i]++;
        if(strstr(s.c_str(), "the") || strstr(s.c_str(), "this") || strstr(s.c_str(), "that") ){
            cout << s;
            return 0;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
char CaesarChar(char );
string CaesarString(string s);
vector<string> CaesarVector(vector<string> v);
vector<string> SolveCaesar(vector<string> v);
int main() {
  string s;
  while( getline(cin,s)) {  
    vector<string> array;
    int space=0;
    int next_space=0;    
    for(int i=0;i<(int)s.size();i++) {
      if(s[i]== ' '){
	next_space=i;
	string tmp="";
	for(int j=space;j<next_space;j++)
	  tmp+=s[j];
	space=next_space+1;
	array.push_back(tmp);
      }
    }
    string tmp="";
    for(int i=next_space+1;i<(int)s.size();i++) 
      tmp+=s[i];
    array.push_back(tmp);
    vector<string> answer=SolveCaesar(array);
    for(int i=0;i<(int)answer.size();i++)
      cout<<answer[i]<<" "; 
    cout<<endl;
  }
  return 0;
}
char CaesarChar(char c) {
  if(c=='z')
    return 'a';
  if(int('a')<=int(c) && int(c)<int('z'))
  return char(c+1);
  return c;
}
string CaesarString(string s) {
  string tmp="";
  for(int i=0;i<(int)s.size();i++)
    tmp+=CaesarChar(s[i]);
  return tmp;
}
vector<string> CaesarVector(vector<string> v) {
  vector<string> tmp;
  for(int i=0;i<(int)v.size();i++) 
    tmp.push_back(CaesarString(v[i]));
  return tmp;
}
vector<string> SolveCaesar(vector<string> v) {
  for(int i=0;i<(int)v.size();i++) {
    if(v[i]=="the" || v[i]=="this" || v[i]=="that")
      return v;
  } 
  return SolveCaesar(CaesarVector(v));
}

C++: #include <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;
const int M = 26;
string S;
vector<string> words{"the","this","that"};

int main()
{
	while(getline(cin,S),S != ""){
		N = S.size();
		FOR(i,0,M){
			bool ok = false;
			FOR(j,0,words.size()){
				ok |= S.find(words [j]) != string::npos;
			}
			if(ok){
				cout << S << endl;
				break;
			}
			FOR(j,0,N) if(S [j] >= 'a' && S [j] <= 'z'){
				S [j] = (S [j] + 1 - 'a') % M + 'a';
			}
		}
	}

	return 0;
}

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

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

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