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 s;
	while (getline(cin, s))
	{
		string dec = s;
		while (true)
		{
			for (int i = 0; i < dec.size(); i++)
			{
				if ('a' <= dec[i] && dec[i] < 'z') dec[i]++;
				if (dec[i] == 'z') dec[i] = 'a';
			}
			if (dec.find("the") == -1 && dec.find("this") == -1 && dec.find("that") == -1) continue;
			cout << dec << endl;
			break;
		}
	}

	return 0;
}

C++: module main;
import std.stdio;
import std.string;

void main()
{
  string s;
  while((s = chomp(readln())).length)
  {
    char s2[] = new char[s.length];
    for(auto i = 0; i < 26; i++)
    {
      for(auto j = 0; j < s.length; j++)
      {
        s2[j] = s[j];
        if(!(s[j] == ' ' || s[j] == '\n' || s[j] == '.'))
          s2[j] = 'a' + ((s[j] - 'a') + i) % 26;
      }

      if(s2.indexOf("the") != -1 || s2.indexOf("this") != -1 || s2.indexOf("that") != -1)
      {
        writef("%s\n", s2);
        break;
      }
    }
  }
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
using namespace std;
int main(){
	
	char s[100];
	while(cin.getline(s,100)){
		for(int i=0;s[i]!='\0';i++){
			if((s[i]-s[i+1]=='t'-'h')&&(((s[i+1]-s[i+2]=='h'-'i')&&(s[i+2]-s[i+3]=='i'-'s'))||(s[i+1]-s[i+2]=='h'-'e')||((s[i+1]-s[i+2]=='h'-'a')&&(s[i+2]-s[i+3]=='a'-'t')))){
				for(int j=0;s[j]!='\0';j++){
					if((s[j]!=' ')&&(s[j]!='.')){
						if(s[j]+'t'-s[i]-'a'<0){
							putchar('z'-'a'+s[j]+'t'-s[i]+1);
						}else{
							putchar(s[j]+'t'-s[i]);
						}
					}else{
						putchar(s[j]);
					}
				}cout<<endl;
				break;
			}
		}
	}
}

C++: #include <stdio.h>
#include <string.h>
int len=0,i=0,j;char RideBack[50][85];
void MORPH() {
	for (j=0;j<=i;j++) {for (int left=0,right=strlen(RideBack[j]);left<right;left++)
		if (RideBack[j][left]>='a' && RideBack[j][left]<='z') {RideBack[j][left]=(RideBack[j][left]-'a'+len)%26+'a';}
	if (j) printf(" ");printf("%s",RideBack[j]);}
}
void blocks() {
	int left,right=strlen(RideBack[i]);for (left=1;left<=26;left++) {
		for (j=0;j<right;j++)
			if (RideBack[i][j]>='a' && RideBack[i][j]<='z') {RideBack[i][j]++;if (RideBack[i][j]>'z') RideBack[i][j]='a';}
		if (RideBack[i][0]=='t' && RideBack[i][1]=='h') {
			if (right==3 && RideBack[i][2]=='e') len=left;
			else if (right==4 && RideBack[i][2]=='i' && RideBack[i][3]=='s') len=left;
			else if (right==4 && RideBack[i][2]=='a' && RideBack[i][3]=='t') len=left;
		}
	}
}
int main() {char T;while (1) {scanf("%s",&RideBack[i]);if (scanf("%c",&T)==EOF) {blocks();MORPH();puts("");return 0;} else if (T=='\n') {blocks();MORPH();puts("");i=0,len=0;} else blocks(),i++;}}

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

bool IncludeKeyWords(const string& Sentence)
{
	if(Sentence.find("the")  <= 80) return true;
	if(Sentence.find("this") <= 80) return true;
	if(Sentence.find("that") <= 80) return true;
	return false;
}

string OneShift(string Sentence)
{
	for(int i = 0; i < Sentence.size(); i++){
		if(97 < Sentence[i] && Sentence[i] < 123){
			Sentence[i] --;
		}else if(Sentence[i] == 97){
			Sentence[i] = 123;
		}
	}
	return Sentence;
}

string Decrypt(string Sentence)
{
	int RoopCount = 0;
	while(IncludeKeyWords(Sentence) == false){
		assert(RoopCount < 26);
		Sentence = OneShift(Sentence);
		RoopCount++;
	}
	return Sentence;
}

int main()
{
	while(true){
		string Sentence;
		getline(cin, Sentence);
		if(cin.eof() == true) break;
		string DecryptedSentence = Decrypt(Sentence);
		cout << DecryptedSentence << endl;
	}
	return 0;
}

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

class MyTransform {
private :
   int shift ;
public :
   MyTransform( int s ) : shift( s ) { }

  char operator( )( char c ) {
      if ( isspace( c ) )
	 return ' ' ;
	 else if(ispunct(c))
              return c;
      else {
	 static std::string letters( "abcdefghijklmnopqrstuvwxyz" ) ;
	 std::string::size_type found = letters.find(tolower( c )) ;
	 int shiftedpos = ( static_cast<int>( found ) + shift ) % 26 ;
	 if ( shiftedpos < 0 ) //in case of decryption possibly
	    shiftedpos = 26 + shiftedpos ;
	 char shifted = letters[shiftedpos] ;
	 return shifted ;
      }
  }
} ;

int main( ) {
        
   std::string input ;
   while(getline( std::cin , input )) {
   int myshift = 4 ;
   myshift *= -1 ; //decrypting again
   std::transform ( input.begin( ) , input.end( ) , input.begin( ) ,
	 MyTransform( myshift ) ) ;
   std::cout << input << std::endl ;
   }
   return 0 ;
}

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

bool dec(string str, string array[]) {
  for (int i = 0; i < 3; i++) {
    if (str.find(array[i], 0) != string::npos) return false;
  }
  return true;
}

int main() {
  string array[3] = {"the", "this", "that"};
  while (1) {
    string str;
    getline(cin, str);
    while (dec(str, array)) {
      for (int i = 0; i < (int)str.size(); i++) {
	if ('a' <= str[i] && str[i] <= 'z') {
	  if (str[i] == 'z') str[i] = 'a';
	  else str[i]++;
	}
      }      
    }
    cout << str << endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
	string str;

	while(getline(cin,str)){
		for(int j=0;j<26;j++){
			for(int i=0;i<str.size();i++){
				if(str[i]>='a'||str[i]<='z'){
					if(str[i]=='z'){
						str[i]='a';
					}else{
						str[i]+1;
					}
				}
			}
			if(str.find("the")!=string::npos||str.find("this")!=string::npos||str.find("that")!=string::npos){
				cout<<str<<endl;
			}
		}
	}
	return 0;
}

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