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 <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){
	string line;

	while(getline(cin, line)){
		int flag = 0;

		for(int i=0 ; i<26 ; i++){
			for(int j=0 ; j<line.size() ; j++){
				if(line[j] != ' ' && line[j] != '.'){
					if(line[j] == 'a'){
						line[j] = 'z' ;
					}else{
						line[j]--;
					}
				}
			}

			for(int k=0 ; k<line.size()-2 ; k++){
				if(line[k] == 't' && line[k+1] == 'h'){
					flag = 1;
					cout << line << endl;
					break;
				}
			}
			if(flag == 1) break;
		}
		//cout << line << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	string S[80]; int C = 0;

	while (getline(cin, S[C]))
	{
		C++;
	}

	for (int i = 0; i < 26; i++)
	{
		for (int c = 0; c < C; c++)
		{
			if (!(S[c].find("this") == string::npos && S[c].find("that") == string::npos && S[c].find("the") == string::npos))
			{
				for (int j = 0; j < C; j++) { cout << S[j] << endl; }

				goto Exit;
			}

			for (string::size_type j = 0; j < S[c].size(); j++)
			{
				if (isalpha(static_cast<int>(S[c][j])))
				{
					if (S[c][j] == 'z')
					{
						S[c][j] = 'a';
					}
					else
					{
						S[c][j]++;
					}
				}
			}
		}
	}

Exit:;

	return 0;
}

C++: //
// Created by Tian Wang on 16/4/3.
//
#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool ascii_diff(string x1, string x2) {
    int len = x1.size();
    bool flag = true;
    for(int i = 1; i < len; i++) {
        int diff1 = (int)x1[i] - (int)x1[i-1];
        int diff2 = (int)x2[i] - (int)x2[i-1];
        if(diff1 != diff2) {
            flag = false;
        }
    }
    return flag;
}

int main() {
    string str1 = "the";
    string str2 = "this";
    string str3 = "that";
    string x;
    int len, len_whole;
    int diff=0;
    string word;
    int word_len;
    int sent_len;
    int ascii;
    char k;
    vector<string> input;

    for(string line; getline(cin, line);) {
        len_whole = line.size();
        string x1;
        for(int i = 0; i < len_whole; i++) {
            k = line[i];

            if((int)k >= 97 & (int)k <=122) {
                x1.push_back(k);
            }
            else {
                input.push_back(x1);
                x1.clear();
                x1.push_back(k);
                input.push_back(x1);
                x1.clear();
            }
        }
        if(x1.size() > 0) {
            input.push_back(x1);
        }
        x1.clear();
        sent_len = input.size();
        for(int i =0; i < sent_len; i++) {
            x = input[i];
            len = x.size();
            if(len == 3) {
                if(ascii_diff(str1, x)) {
                    diff = (int)x[0] - (int)str1[0];
                }
            }
            else if(len == 4) {
                if(ascii_diff(str2, x)) {
                    diff = (int)x[0] - (int)str2[0];
                }
                else if (ascii_diff(str3, x)) {
                    diff = (int)x[0] - (int)str3[0];
                }
            }
        }
        for(int i = 0; i < sent_len; i++) {
            word = input[i];
            word_len = word.size();
            for(int j = 0; j < word_len; j++) {
                ascii = (int)word[j];
                if(ascii >= 97 & ascii <=122) {
                    cout << (char)(ascii-diff);
                }
                else {
                    cout << (char)ascii;
                }
            }
        }
        cout << endl;
        input.clear();
    }
    return 0;
}

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

using namespace std;

void forward(string& data)
{
	for(auto& c : data)
	{
		if(c < 'a' || 'z' < c)
			continue;

		c++;
		if('z' < c)
			c -= 26;
	}
}

bool test(string data)
{
	if(data.find("the") != string::npos)
		return true;
	if(data.find("this") != string::npos)
		return true;
	if(data.find("that") != string::npos)
		return true;

	return false;
}

int main()
{
	while(!cin.eof())
	{
		char buffer[1024];
		cin.getline(buffer, 1024);
		string line(buffer);

		while(true)
		{
			if(test(line))
				break;
			forward(line);
		}

		cout << line << endl;
	}

	return 0;
}

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

int main(){
  string s;

  while(getline(cin, s)){
    int flag = 0;
    
    while(true){
      for(int i=0;i<s.length();i++){
	string key1 = s.substr(i,3), key2 = s.substr(i,4);
	if(key1 == "the" || key2 == "this" || key2 == "that"){
	  flag = 1;
	}
      }
      
      if(flag){
	break;
      }else{
	
    
	for(int i=0;i<s.length();i++){
	  if(s[i] >= 'a' && s[i] <= 'z'){
	    // s[i] -= 'a';
	    // s[i] += 1;
	    // s[i] = s[i]%('A'-'a');
	    // s[i] += 'a';

	    s[i] -= 'a' - 'A';
	    s[i] = (char)('A' + (s[i] - 'A' + 26 + 1)%26);
	    s[i] += 'a' - 'A';
	    
	  }else{
	    continue;
	  }
	}
      }
    }
    cout << s << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
string word[3] = {"this","that","the"};
int main(){
  char c;
  string s[8000];
  int smax = 0;
  while(scanf("%c",&c) != EOF){
    if(c == '\n' || c == ' '){
      smax++;s[smax] += c;
      smax++;
    }else{
      s[smax] += c;
    }
  }smax++;
  bool flag = false;
  while(1){
    for(int i = 0;i < smax;i++){
      for(int j = 0;j < s[i].size();j++){
	if(isalpha(s[i][j])){
	  s[i][j]++;
	  if(s[i][j] == 'z' + 1)s[i][j] = 'a';
	}
	for(int j = 0;j < 3;j++){
	  if(word[j] == s[i]){flag = true;break;}
	}for(int j = 0;j < 3;j++){
	  if(word[j] + '.' == s[i]){flag = true;break;}
	}
      }
    }
    if(flag)break;
  }
  for(int i = 0;i < smax;i++)cout << s[i];
  return 0;
}

C++: #include<cstdio>
using namespace std;
int main()
{
    char a[1500]={0};
    while(scanf("%[^\n]",a)!=EOF)
    {
        getchar();
        for(;;)
        {
            for(int i=0;;i++)
            {
                if(a[i]==0)break;
                if(a[i]==122)a[i]=97;
                else if(97<=a[i]&&a[i]<122)a[i]++;
                else;
            }
            for(int i=0;;i++)
            {
                if(a[i]==0)break;
                if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='i'&&a[i+3]=='s'&&(a[i+4]==' '||a[i+4]=='.'||a[i+4]==0))goto end;
                if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='a'&&a[i+3]=='t'&&(a[i+4]==' '||a[i+4]=='.'||a[i+4]==0))goto end;
                if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='e'&&(a[i+3]==' '||a[i+3]=='.'||a[i+3]==0))goto end;
            }
        }
        end:;
        printf("%s\n",a);
        for(int i=0;i<1500;i++)
        {
            a[i]=0;
        }
    }
    return 0;
}