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 <iostream>
#include <string>
using namespace std;
int main()
{
	string str;
	while(getline(cin,str))
	{
		bool flag=false;
		for(int k=0;k<26;k++)
		{
			int i=0;
			for(i=0;i<str.size();i++)
			{
				if(str[i]-'a'<0 || str[i]-'z'>0) continue;
				else { str[i]++; if(str[i]-'z'>0) str[i]-=26; }
			};
			string ptr,qtr;
			for(i=0;i<str.size();i++)
			{
				if(i+4<str.size()) ptr=str.substr(i,4);
				if(i+3<str.size()) qtr=str.substr(i,3);
				if(ptr=="this" || ptr=="that" || qtr=="the") {flag=true; break;}
			};
			if(flag==true) break;
		};
		cout << str << endl ;
	}
}

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

int main(){

  string s;

  while(getline(cin,s)){
    while(s.find("the")==string::npos && s.find("this")==string::npos && s.find("that")==string::npos){
      for(int i=0; i<s.size(); i++){
        if('a'<=s[i]&&s[i]<='y')
          s[i] ++;
        else if(s[i]=='z'){
          s[i]='a';
        }
      }
    }
    cout << s << endl;
  }


  return 0;
}

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

bool is_valid(const std::string& str) {
	if (str.find("the ") != std::string::npos
		|| str.find("this ") != std::string::npos
		|| str.find("that ") != std::string::npos
		|| str.find(" the ") != std::string::npos
		|| str.find(" this ") != std::string::npos
		|| str.find(" that ") != std::string::npos
		|| str.find(" the") != std::string::npos
		|| str.find(" this") != std::string::npos
		|| str.find(" that") != std::string::npos) {
		return true;		
	}
	return false;
}

int main() {
	std::string str;
	std::getline(std::cin, str);
	
	std::string ans;
	const int limit = 'z' - 'a' + 1;
	for (int i = 0; i < limit; ++i) {
		for (auto c : str) {
			int elem = c + i;
			if (c >= 'a' && c <= 'z') {
				if (elem > 'z') {
					elem = 'a' + elem - ('z' + 1);
				}
				ans.push_back(elem);
			} else {
				ans.push_back(c);
			}
		}
		if (is_valid(ans)) {
			break;
		}
		ans.clear();
	}
	
	std::cout << ans << std::endl;
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

char p(char ch){
    char ret=ch+1;
    if(ret==('{'))ret='a';
    return ret;
}


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


    rep(i,30){
        rep(i,s.size()){
            if(s[i]!=' ' && s[i]!='.'){
                s[i]=p(s[i]);
            }
        }

        if( s.find("the",0)!=-1 || s.find("this",0)!=-1 || s.find("that",0)!=-1 ){
            cout<<s<<endl;
            break;
        }
    }
    
    return 0;
    
}

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

using namespace std;

string line;
int str_len;

bool is_finish() {
  for(int i=0; i<str_len-3; i++) {
    if(line[i] == 't') {
      if(line[i+1] == 'h') {
        if(line[i+2] == 'e') { return true; }
        else if(line[i+3] == 'i' && line[i+4] == 's') { return true; }
        else if(line[i+3] == 'a' && line[i+4] == 't') { return true; }
      }
    }
  }
  return false;
};


int main() {
  getline(cin, line);
  str_len = line.length();
  
  for(int j=0; j<26; j++) {
    if(is_finish()) { 
      cout << line << endl;
      break; 
    }

    for(int j=0; j<str_len; j++) {
      if('a' <= line[j] && line[j] < 'z') {
        line[j] += 1;
      }
      else if(line[j] == 'z') {
        line[j] = 'a';
      }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main(){

  //  string x;
  char x[100];
  gets(x);
  //  cin >> x;
  bool is = true;
  if(strlen(x) >= 3){
    for(int i = 0; i < 26 ; i++){
      //the 
      for(int j = 0; j <= strlen(x)-3; j++){
	if(is && x[j] =='t' && x[j+1] == 'h' && x[j+2] == 'e'){
	  is = false;
	  break;
	}
      }
      // this or that
      if(strlen(x) >= 4){
	for(int j = 0; j <= strlen(x)-4; j++){
	  if(is && x[j] =='t' && x[j+1] == 'h' && x[j+2] == 'a' && x[j+3] =='t' ){
	    is = false;
	    break;
	  }
	  if(is && x[j] =='t' && x[j+1] == 'h' && x[j+2] == 'i' && x[j+3] =='s' ){
	    is = false;
	    break;
	  }
	}
      }
      // increment
      if(is == false) break; 
      for(int j = 0; j < strlen(x) ; j++){
	if(x[j] == ' ') x[j] = ' ';
	else if(x[j] == 'z') x[j] = 'a';
	else if(x[j] >= 'a' && x[j] < 'z') x[j]++;
      }
    }
    
    if(is == false)	
      cout << x << endl;
  }
  return 0;
}

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

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

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

void next(string& str)
{
	for(int i=0; i<str.length(); i++)
	{
		if('a'<=str[i] && str[i]<='z')
		{
			str[i] = ((str[i]-'a'+25)%26)+'a';
		}
	}
}

int main()
{
	string str;
	while(getline(cin,str))
	{
		for(int i=0; i<26; ++i,next(str))
		{
			if(-1!=str.find("the") || -1!=str.find("this") || -1!=str.find("that"))
			{
				cout << str << endl;
				break;
			}
		}
	}

	return 0;
}

C++: #define scanf_s scanf
#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
#define ABC 26
int main(void)
{
	int n, s = 0, x, y, r = 0, a, b;
	int sum_n[50][3] = { 0 };
	char sum[50][_MAX], str[_MAX], bstr[_MAX], num[11] = { "0123456789" };
	//
	while(gets_s(str)){
		for (int i = 0; str[i] != '\0'; ++i) {
			if (str[i] - 't' == str[i + 1] - 'h') {
				a = str[i] - 't';
				if ((str[i + 2] - a + 'z') % 'z' == 'e') { b = a; break; }
				else if ((str[i + 2] - a + 'z') % 'z' == 'i' + ABC && (str[i + 3] - a + 'z') % 'z' == 's') { b = a; break; }
				else if ((str[i + 2] - a + 'z') % 'z' == 'a' + ABC && (str[i + 3] - a + 'z') % 'z' == 't') { b = a; break; }
			}
		}
		for (int i = 0; str[i] != '\0'; ++i) {
			if ('a' <= str[i] && str[i] <= 'z') {
				printf("%c", (str[i] - a + 'z') % 'z');
			}
			else { printf("%c", str[i]); }
		}
		printf("\n");
	}
}