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;

int main()
{
    string s;
    while (getline(cin, s))
    {
        for(int n=0; n<26; n++)
        {
            for(int i=0; i<s.size(); i++)
            {
                if(s[i] >= 'a' && s[i] < 'z')
                {
                    s[i]=s[i]+1;
                }
                else if(s[i] == 'z')
                {
                    s[i] = 'a';
                }
                else
                {

                }
            }
            if(  s.find("the")  != std::string::npos
              || s.find("this") != std::string::npos
              || s.find("that") != std::string::npos)
            {
                cout << s << endl;
                break;
            }
        }
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j,k;
  string s;
  while(getline(cin,s)){
    int n=0;
    rep(i,s.size())if(s[i]==' ')n++;
    n++;
    vector<string> word(n);
    i=0;
    rep(j,n){
      while(s[i]>='a' && s[i]<='z')
    word[j].push_back(s[i]),i++;
      i++;
    }
    rep(k,26){
      bool c=false;
      rep(i,n)rep(j,word[i].size())
    if(word[i][j]=='z')word[i][j]='a';
    else word[i][j]=word[i][j]+1;
      rep(i,n)
    if(word[i]=="the" || word[i]=="this" || word[i]=="that"){
      c=true;break;
    }
      if(c){
    rep(i,n){
      if(i)cout<<" ";
      cout<<word[i];
    }
    cout<<endl;
    break;
      }
    }
  }
}

C++: #include<cstdio>
#include<iostream>
#include<cstring>

using namespace std;

int the[2],that[3],_this[3];

bool checkThe(char s[]){
  if(strlen(s)!=3){
    return false;
  }else{
    if(s[0]-s[1]==the[0] && s[1]-s[2]==the[1]){
      return true;
    }
  }
  return false;
}
bool checkThis(char s[]){
  if(strlen(s)!=4){
    return false;
  }else{
    if(s[0]-s[1]==_this[0] && s[1]-s[2]==_this[1] && s[2]-s[3]==_this[2]){
      return true;
    }
  }
  return false;
}
bool checkThat(char s[]){
  if(strlen(s)!=4){
    return false;
  }else{
    if(s[0]-s[1]==that[0] && s[1]-s[2]==that[1] && s[2]-s[3]==that[2]){
      return true;
    }
  }
  return false;

}
int main(){
  int key=0;
  char str[100];
  char temp[100];
 

  the[0]='t'-'h';
  the[1]='h'-'e';

  that[0]='t'-'h';
  that[1]='h'-'a';
  that[2]='a'-'t';

  _this[0]='t'-'h';
  _this[1]='h'-'i';
  _this[2]='i'-'s';
    
  char *tok;
  bool f=false;
  while(fgets(str,sizeof(str),stdin)!=NULL){
  
    for(int i=0;i<strlen(str);i++)
      temp[i]=str[i];
    temp[strlen(str)]='\0';

    str[strlen(str)]='\0';
    str[strlen(str)-1]='\0';
    tok=strtok(str," ");
 
    if(strlen(tok)==3){
      if(checkThe(tok)==true){
	key=tok[0]-'t';
	f=true;
      }
    }else if(strlen(tok)==4){
      if(checkThat(tok)==true){
	key=tok[0]-'t';
	f=true;
      }else if(checkThis(tok)==true){
	key=tok[0]-'t';
	f=true;
      }
    }
    while(f==false && tok!=NULL){
      tok=strtok(NULL," ");
      if(tok!=NULL){
	if(strlen(tok)==3){
	  if(checkThe(tok)==true){
	    key=tok[0]-'t';
	    f=true;
	  }
	}else if(strlen(tok)==4){
	  if(checkThat(tok)==true){
	    key=tok[0]-'t';
	    f=true;
	  }else if(checkThis(tok)==true){
	    key=tok[0]-'t';
	    f=true;
	  }
	}
      }
    }
   
    for(int i=0;i<strlen(temp);i++){
      if('a'<=str[i] && str[i]<='z'){
	printf("%c",temp[i]-key);
      }else{
	printf("%c",temp[i]);
      }
    }

  }

  return 0;
}

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

int main() {
  string s;
  getline(cin, s);

  bool b = false;
  for(int i = 1; i < 26; i++) {
    string change;
    for(int j = 0; j < s.size(); j++) {
      if('a' <= s[j] && s[j] <= 'z') change += (s[j]+i)%26 + 'a';
      else change += s[j];
    }

    for(int j = 0; j < change.size(); j++) {
      string tmp = change.substr(j,4);
      if(tmp == "this" || tmp == "that") b = true;
      if(tmp.substr(0,3) == "the") {
	if('a' > tmp[3] || tmp[3] > 'z') {
	  b = true;
	}
      }
    }
    if(b) {
      cout << change << endl;
      break;
    }
  }
}