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;

void decodeOneChar(string& str) {
    for (int i = 0; i < (int)str.length(); i++) {
        if ('a' <= str[i] && str[i] < 'z') {
            str[i]++;
        } else if (str[i] == 'z') {
            str[i] = 'a';
        }
    }
}

int main() {
    string input;
    while (getline(cin, input)) {
        while (input.find("the") == string::npos && input.find("this") == string::npos && input.find("that") == string::npos) {
            decodeOneChar(input);
        }
        cout << input << endl;
    }
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int ans=-1,len=0;
  string s;
  while(getline(cin,s)){
    //getline(cin,s);
    //if(s==EOF) break;
    while(1/*len<30*/){
      ans = s.find("the");
      if(ans!=-1)break;
      ans = s.find("this");
      if(ans!=-1)break;
      ans = s.find("that");
      if(ans!=-1)break;
      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]++;
      }
      //len++;
    }
    cout << s << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	getline(cin,s);t=s;
	for(int i=0;i<26;i++){
		s=t;
		for(int j=0;j<s.size();j++){
			for(int k=0;k<i;k++){
				s[j]++;
				if(s[j]>'z')s[j]-=26;
			}
		}
		if(s.find("the")!=s.npos||s.find("this")!=s.npos||s.find("that")!=s.npos)break;
	}
	cout<<s<<endl;
}

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

C++: #include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main() {
	string str;
	while(getline(cin, str)) {
		int n = 't' - str[0];
		for(int i = 0; str[i] != '\0'; i++) {
			if(('a' <= str[i])&&(str[i] <= 'z')) {
				str[i] += n;
				if(str[i] > 'z') {
					str[i] = str[i] - 26;
				}
			}
		}
		cout << str << endl;
	}
	return 0;
}

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

using namespace std;

string str;

bool caesar()
{
	bool flag = false;

	for (int i=0; i<(int)str.size() - 3; i++)
	{
		if(str[i] == 't' && str[i+1] == 'h') {
			if(str[i+2] == 'e' && (str[i+3] == ' ' || str[i+3] == '\0')) {
				flag = true;
				break;
			}
			if(str[i+2] == 'i' && str[i+3] == 's' && (str[i+4] == ' ' || str[i+4] == '\0')) {
				flag = true;
				break;
			}
			if(str[i+2] == 's' && str[i+3] == 't' && (str[i+4] == ' ' || str[i+4] == '\0')) {
				flag = true;
				break;
			}
		}
	}

	return flag;
}


int main()
{
	getline(cin, str);

	for (int i=0; i<25; i++)	//25文字ずれるまで繰り返す
	{
		if(caesar()) {
			cout << str << endl;
		}

		for (int j=0; str[j] != '\0'; j++) {
			if(str[j] != ' ' && str[j] != '.') {
				if(str[j] == 'z') {
					str[j] = 'a';
				}
				else {
					str[j]++;
				}
			}
		}
	}

	return 0;
}

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

int main(){

  int n;
  string s;
  int k;

  getline(cin,s);

  for(int i=-25;i<26;i++){
    bool d = false;
 
    for(int j=0;j<s.size();j++){

      if((s[j-1] == ' ' || j == 0) && s[j]+i == 't' && s[j+1]+i == 'h'){
	if(s[j+2]+i == 'e' && (s[j+3] == ' ' || j+3 == s.size())) d = true;
	if(s[j+2]+i == 'i' && s[j+3]+i == 's' && (s[j+4] == ' ' || j+4 == s.size())) d = true;
	if(s[j+2]+i == 'a' && s[j+3]+i == 't' && (s[j+4] == ' ' || j+4 == s.size())) d = true;
      }

      if(d == true) break;
    }

    if(d == true){
      k = i;
      break;
    }

  }

  for(int i=0;i<s.size();i++){
    if(s[i] >= 'a' && s[i] <= 'z') printf("%c",s[i]+k);
    else printf("%c",s[i]);
  }

  cout << endl;
}

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

bool checkString(int* key, string s);
void rotateChar(string* s, int i);

int main()
{
    string text;
	while( getline(cin, text) ){
		char ch;
		string s;
		list<string> table;
		for(int i=0; i<text.size(); i++){
			ch = text[i];
			if(ch!=' ')s.push_back(ch);
			else{ table.push_back(s), s.clear();}
		}		

		int key; // ずらす文字数
		list<string>::iterator i;
		for(i=table.begin(); i!=table.end(); i++){
			// cout << *i << " ";
			if( i->size() == 3 || i->size() == 4 )
				if( checkString(&key, *i) ) break;
		}
	
		for(int i=0; i<text.size(); i++){
			char ch = text[i];
			if(isalpha(ch)){
				char c = ch - 'a';
				ch = 'a' + (c+key)%26;
			}
			cout.put(ch);
		}
		cout << endl;
		text.clear();
	}
    return 0;
}

void rotateChar(string* s, int i) // iは何文字ずらしたいか
{

    for(int j=0; j<s->size(); j++){
        if(!isalpha(s->at(j))){continue;}
        char c = s->at(j) - 'a';
        s->at(j) = 'a' + (c+i)%26;
    }
}

bool checkString(int* key, string s)
{

    for(int i=0; i<26; i++){
        string tmp = s;
        rotateChar(&tmp, i);
        // cout << tmp << endl;
        if( tmp=="the" || tmp=="this" || tmp=="that" ){
            *key=i;
            return true;
        }
    }
    return false;
}