Go: package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

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 scanner.Scan() {
		infos := strings.Split(scanner.Text(), " ")
		plain := make([]string, len(infos))
		// 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)) {
		string st = str;
		string s[1000],h="";
		str += " ";
		int c = 0;
		for (int i = 0; i < str.length(); i++) {
			for (int j = i; j < str.length(); j++) {
				if (str[j] == '.' || str[j] == ' ') {
					if (h != "") {
						s[c] = h;
						h = "";
						c++;
					}
					i = j ;
					break;
				}
				else
					h += str[j];
			}
		}
		int w = 0;
		for (int i = 0; i < c; i++) {
			if (s[i].length() == 3 || s[i].length() == 4) {
				int t = (int)'t' - (int)s[i][0];
				string h = "t";
				for (int j = 1; j < s[i].length(); j++) {
					int u = t + (int)s[i][j];
					if (u > 'z') u -= 26;
					else if (u < 'a') u += 26;
					h += (char)u;
				}
				if (h == "the" || h == "that" || h == "this") {
					w = t;
					break;
				}
			}
		}
		string stri = "";
		for (int i = 0; i < st.length(); i++) {
			if (st[i] == ' ' || st[i] == '.')
				stri += st[i];
			else {
				int u;
				u = (int)st[i] + w;
				if (u > 'z') u -= 26;
				else if (u < 'a')u += 26;
				stri += (char)u;
			}
		}
		cout << stri << endl;
	}
}

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

//2^32/26 = 165191049.846153846153846 = 165191050
#define MAGIC 0x9D89D8A

char shift (char c, int amount)
{
    long n;
    long q ;
    long r;
    
    n = (long) c - 'a' +  amount;
    q = n * MAGIC;
    q >>= 32;
    r = n - q * 26;
    
    return (char) 'a' + r;
}

void shiftString (char* s, int amount)
{
    int i = 0;
    while (s[i]) {
        
        if (s[i] == ' ') {}
        else if (s[i] == '.') {}
        else { s[i] = shift(s[i], amount); }
        i++;
    }
    
}

int main(int argc, const char * argv[]) {

   
    char buffer[256];
    std::string line;
    std::vector<std::string> listString;
    int result = 0;
    std::size_t found;
    
    
    while (std::getline(std::cin, line))
    {
        //sprintf(buffer, "%s", line.c_str());
        listString.push_back(line);
    }
    
    
    std::vector<std::string>::iterator it;
    
    it = listString.begin();
    
    do {
        result = 0;
        sprintf(buffer, "%s", (*it).c_str());
        
        while (!result)
        {
            
            shiftString(buffer, -1);
            line = buffer;
            
            result = 0;
            
            found = line.find("the");
            result += found!=std::string::npos;
            
            found = line.find("this");
            result += found!=std::string::npos;

            found = line.find("that");
            result += found!=std::string::npos;

        }
        
        printf("%s\n", buffer);
        
    } while (++it < listString.end());

    return 0;
}

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

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

C++: #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	int num,x=0;
	string str,sum,ans;
	char c;
	while(getline(cin,str)){
		for(int j=0;j<26;j++){
			sum="";
			for(int i=0;i<str.size();i++){
				if('a'<=str[i]&&str[i]<='y'){
					c=str[i];
					c+=1;
					sum+=c;
				}else if(str[i]=='z'){
					c=str[i];
					c-=25;
					sum+=c;
				}else{
					c=str[i];
					sum+=c;
				}
			}
			swap(str,sum);
			num=0;
			for(int l=0;l<str.size();l++){
				if(str[l]==' '||str[l]=='.'){
					ans="";
					for(int k=num;k<l;k++){
						c=str[k];
						ans+=c;
					}
					num=l+1;
					if(ans=="this"||ans=="that"){
						x=1;
						break;
					}else if(ans=="the"){
						x=1;
						break;
					}
				}
			}
			if(x==1){
				cout<<str<<endl;
				x=0;
				break;
			}
		}
	}
	return 0;
}

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

int main(int argc, char *argv[]){
	string s;
    while(getline(cin,s)){

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

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

int main(){
  char cip[80][80];
  int words;
  int i, j;
  int gap;

  words=0;
  while(cin>>cip[words]) words++;

  for(i=0; i<words; i++){
    for(j=0; j<strlen(cip[i]); j++){
      if(cip[i][j]=='.') continue;
      cip[i][j]-='a';
    }
    if(strlen(cip[i])==3
       && (cip[i][1]-cip[i][0]+26)%26==14
       && (cip[i][2]-cip[i][0]+26)%26==11){
      gap=(cip[i][0]-('t'-'a')+26)%26;
      continue;
    }
    if(strlen(cip[i])==4
       && (cip[i][1]-cip[i][0]+26)%26==14
       && (cip[i][2]-cip[i][0]+26)%26==15
       && (cip[i][3]-cip[i][0]+26)%26==25){
      gap=(cip[i][0]-('t'-'a')+26)%26;
      continue;
    }
    if(strlen(cip[i])==4
       && (cip[i][1]-cip[i][0]+26)%26==14
       && (cip[i][2]-cip[i][0]+26)%26==7
       && (cip[i][3]-cip[i][0]+26)%26==0){
      gap=(cip[i][0]-('t'-'a')+26)%26;
      continue;
    }
  }
  for(i=0; i<words; i++){
    for(j=0; j<strlen(cip[i]); j++){
      if(cip[i][j]=='.') continue;
      cip[i][j]=(cip[i][j]-gap+26)%26+'a';
    }
    if(i==words-1) printf("%s\n", cip[i]);
    else printf("%s ", cip[i]);
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

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

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

using namespace std;


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