Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func incrementByte(b byte) byte {
	if b >= 97 && b < 122 {
		return b + 1
	} else if b == 122 {
		return 97
	}
	return b
}

func main() {
	scanner.Split(bufio.ScanLines)

	for {
		line := nextString()
		if len(line) == 0 {
			break
		}
		for i := 0; i <= 26; i++ {
			decoded := []byte{}
			for j := 0; j < len(line); j++ {
				decoded = append(decoded, incrementByte(line[j]))
			}
			line = string(decoded)
			if strings.Contains(line, "the") || strings.Contains(line, "this") || strings.Contains(line, "that") {
				fmt.Println(line)
				break
			}
		}
	}
}

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

using namespace std;

void shiftchar(char& ch)
{
	if (isalpha(ch)) {
		if (ch == 'z') {
			ch = 'a';
		} else {
			ch = ch + 1;
		}
	}
}

int main()
{
	string input;
	while (getline(cin, input)) {

		string decoded = input;
		for (int i = 0; i < 26; ++i) {
			for_each(decoded.begin(), decoded.end(), shiftchar);
			if (decoded.find("the") != string::npos ||
				decoded.find("this") != string::npos ||
				decoded.find("that") != string::npos) {
				break;
			}
		}

		cout << decoded;
	}

	return 0;
}

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

string in;
vector<string> V;

string change(string in){
  for(int i = 0; i < in.length(); i++){
    if(in[i] != 'a') in[i]--;
    else in[i] = 'z';
  }
  return in;
}
string solve(){
  int status = 0;
  while(1){
    for(int i = 0; i < V.size(); i++){
      string str = V[i];
      if(str != "." && str != " ") V[i] = change(str);
      if(V[i] == "the" || V[i] == "this" || V[i] == "that") status = 1;
    }
    if(status)break;
  }
  string out;
  for(int i = 0; i < V.size(); i++){
    out += V[i];
  }
  return out;
}
int main(){
  while(getline(cin,in)){
    V.clear();
    in += "\n";
    string str;
    for(int i = 0; i < in.length(); i++){
      if(in[i] < 'a' || in[i] > 'z'){
	V.push_back(str);
	str = "";
	if(in[i] == '.') V.push_back(".");
	if(in[i] == ' ') V.push_back(" ");
      }else str += in[i];
    }
    cout << solve() << endl;
  }
  return 0;
}

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

int main(void) {
  string t[3] = {"the", "this", "that"};
  string str;
  
  while(getline(cin, str)) {
    while(1) {
      for(int i=0; i<str.length(); i++) if(str[i] != ' ' && str[i] != '.') str[i] = (str[i]-'a' + 1)%26 + 'a';
      for(int i=0; i<3; i++) if(str.find(t[i])!=string::npos) goto fi;
    }
  fi:
    cout << str << endl;
  }
  return 0;
}

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

char* Rest(char *before, char lag);

int main(void)
{
	char before[1000];
	
	scanf("%[^\n]", before);
	
	if (before[0] == 't'){
		printf("%s\n", before);
	}
	else if (before[0] < 't'){
		printf("%s\n", Rest(before, 't' - before[0]));
	}
	else if (before[0] > 't'){
		printf("%s\n", Rest(before, before[0] - 't'));
	}
	
	return (0);
}

char* Rest(char *before, char lag)
{
	int i;
	char ans[1000];
	for (i = 0; before[i] != '\0'; i++){
		
		if (before[i] >= 'a' && before[i] <= 'z' ||
			before[i] >= 'A' && before[i] <= 'Z'){
			
			if (before[i] - lag < 'a'){
				ans[i] = before[i] - lag + 26;
			}
			else if (before[i] - lag > 'z'){
				ans[i] = before[i] - lag - 26;
			}
			else {
				ans[i] = before[i] - lag;
			}
		}
		else {
			ans[i] = before[i];
		}
	}
	ans[i] = '\0';
	
	return (ans);
}

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

int suggest_cipher_num(std::string str)
{
  std::vector<std::string> token;
  int i = 0, j = str.find(" ", 0);
  while (j != std::string::npos) {
    token.push_back(str.substr(i, j - i));
    i = j + 1;
    j = str.find(" ", i);
  }
  token.push_back(str.substr(i, str.length() - i));
  
  for (auto it = token.begin(); it != token.end(); ++it) {
    std::string& tok = *it;
    if (tok.length() == 3) {
      // check if this token is ciphered "the"
      int diff[] = {tok[0] - tok[1], tok[1] - tok[2]};
      for (int i = 0; i < 2; i++) {
        if (diff[i] < 0) diff[i] += 'z' - 'a';
      }
      
      if (diff[0] == 't' - 'h' && diff[1] == 'h' - 'e') {
        return 't' - tok[0];        
      }
    }
    else if (tok.length() == 4) {
      // check if this token is ciphred "this" or "that"
      int diff[] = {tok[0] - tok[1], tok[1] - tok[2], tok[2] - tok[3]};
      if (diff[0] != 't' - 'h' && diff[0] + ('z' - 'a') != 't' - 'h') break;
      if (diff[1] == 'h' - 'i' || diff[1] - ('z' - 'a') == 'h' - 'i') {
        if (diff[2] == 'i' - 's' || diff[2] - ('z' - 'a') == 'i' - 's') {
          return 't' - tok[0];
        }
      }
      else if (diff[1] == 'h' - 'a' && diff[1] + ('z' - 'a') != 'h' - 'a') {
        if (diff[2] == 'a' - 't' && diff[2] - ('z' - 'a') == 'a' - 't') {
          return 't' - tok[0];
        }
      }
    }
  }
}

int main()
{
  std::string line;
  while (std::getline(std::cin, line)) {
    auto key = suggest_cipher_num(line);
    for (const auto& c: line) {
      if (c == ' ' || c == '.') {
        std::cout << c;
      } else if(c + key < 'a') {
        std::cout << static_cast<char>(c + key + 'z');
      } else {
        std::cout << static_cast<char>(c + key);
      }
    }
    std::cout << std::endl;
  }
  return 0;
}

C++: #include<iostream>
#include<ctype>
#include<string>
using namespace std;
bool find(string s){
	return s.find("the",0)!=string::npos
		|| s.find("this",0)!=string::npos
		|| s.find("that",0)!=string::npos;
}
string rotate(string s,int n){
	for(int i=0;i<s.size();i++){
		if(isalpha(s[i]))s[i] = (s[i]-'a'+n)%26+'a';
	}
	return s;
}
int main(){
	string s;
	while(getline(cin,s)){
		for(int i=0;i<26;i++){
			if(find(rotate(s,i))){
				cout<<rotate(s,i)<<endl;
				break;
			}
		}
	}
	return 0;
}

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

using namespace std;

char returnc(char c){
  if('a'<=c && c<='z'){
    if(c=='z')return 'a';
    return ++c;
  }
  return c;
}
int main(void){
  vector<string> ss;
  string s,str;
  getline(cin,s);
  s+= " ";
  for(int i = 0 ; i < s.size() ; i ++){
    if(s[i] == ' '){
      ss.push_back(str);
      str="";
    }else{
      str+=s[i];
    }
  }
  bool ok=true;
  string out[] = {"this","that","the"};
  while(ok){
    for(int i = 0 ; i < ss.size(); i ++){
      //cout<<ss[i]<<endl;
      for(int j = 0 ; j < ss[i].size() ; j ++){
	ss[i][j] = returnc(ss[i][j]);
      }
      for(int j = 0 ; j < 3 ; j ++){
	if(ss[i] == out[j])ok=false;
      }
    }
  }
  for(int i = 0 ; i < ss.size()-1 ; i ++){
    cout<<ss[i]<<" ";
  }
  cout<<ss[ss.size() - 1]<<endl;
}

C++: /*AOJ 0017*/

#include<iostream>
#include<string>

using namespace std;

char shiftCaesar(char tmp){
	if(tmp>='a' && tmp<= 'y'){
		return tmp+1;
	}
	else if(tmp == 'z'){
		return 'a';
	}
	else{
		return tmp;
	}
}

int main(){
	char str[100];
	string tmp;

	while(cin.getline(str,100)){

		for(;;){

			tmp = str;

			if( tmp.find("the") != -1 || tmp.find("this") != -1 || 
				tmp.find("that") != -1){
					break;
			}

			for(int i=0;str[i]!='\0';i++){
				str[i] = shiftCaesar(str[i]);
			}


		}

		cout<<tmp<<endl;

	}
	return 0;
}