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 stro, str;
  while(getline(cin, stro)){
    for(int i = 0; i < 26; i++){
      str = stro;
      for(int j = 0; j < stro.length(); j++){
	if(str[j] >= 'a' && str[j] <= 'z')
	  if(str[j] + i > 'z')
	    str[j] += i - 26;
	  else
	    str[j] += i;
      }
      unsigned f_the = str.find("the", 0);
      unsigned f_this = str.find("this", 0);
      unsigned f_that = str.find("that", 0);
      if((f_the != string::npos && f_the == 0 && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\0')) || (f_this != string::npos && f_this == 0 && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\0')) || (f_that != string::npos && f_that == 0 && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\0')))
	cout << str << endl;
      else if((f_the != string::npos && (str[(f_the - 1 < 0) ? 0 : f_the - 1] == ' ' || str[(f_the - 1 < 0) ? 0 : f_the - 1] == '.' || str[(f_the - 1 < 0) ? 0 : f_the - 1] == '\n') && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\0')) || (f_this != string::npos && (str[(f_this - 1 < 0) ? 0 : f_this - 1] == ' ' || str[(f_this - 1 < 0) ? 0 : f_this - 1] == '.' || str[(f_this - 1 < 0) ? 0 : f_this - 1] == '\n') && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\0')) || (f_that != string::npos && (str[(f_that - 1 < 0) ? 0 : f_that - 1] == ' ' || str[(f_that - 1 < 0) ? 0 : f_that - 1] == '.' || str[(f_that - 1 < 0) ? 0 : f_that - 1] == '\n') && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\0')))
	cout << str << endl;	 
    }
  }
}

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

int main(){
  char a[100],b[100];
  for(int i;i<100;i++){
    a[i]='\0';
    b[i]='\0';
  }
  gets(a);
  int i=0;
  while(i<26){
    for(int j=0;!(a[j]=='\0');j++){
      if(0x61<=a[j]+i&&a[j]+i<=0x7A)
	b[j]+=i;
      else if(0x61<=a[j]&&a[j]<=0x7A){
	b[j]=a[j]-26+i;
      }
      else if(a[j]==' ')
	b[j]=' ';
      else if(a[j]=='.')
	b[j]='.';
    }
    if(strstr(b,"the")||strstr(b,"this")||strstr(b,"that"))
      break;
    i++;
  }
  for(int k=0;a[k]!='\0';k++)
    cout<<b[k];
  cout<<'\n';
  return 0;
}

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

using namespace std;

string decode(string s, int v) {
    string ans = s;
    for(int i = 0; i < (int) s.size(); i++) {
        if(s[i] >= 'a' && s[i] <= 'z') {
            ans[i] = (s[i] + v) % 26 + 'a';
        }
    }
    return ans;
}

int main() {
    string s;
    while(getline(cin, s)) {
        for(int i = 0; 26; i++) {
            string tmp = decode(s, i);
            if(tmp.find("this") != string::npos || tmp.find("the") != string::npos || tmp.find("that") != string::npos) {
                cout << tmp << endl;
                break;
            }
         }
    }
    return 0;
}

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

using namespace std;

int main()
{
  char s[81];

  while(gets(s) != NULL){

    int len = strlen(s);
    
    if(strstr(s,"this") || strstr(s,"that") || strstr(s,"the")){
      cout << s << endl;
      continue;
    }
    
    for(int i = 0;i < len;i++){
      for(int j = 0;j < len;j++){
	if(s[j] >= 'a' && s[j] <= 'z'){
	  if(s[j]+1 > 'z'){
	    s[j] = 'a';
	  }
	  else{
	    s[j]++; 
	  }
	}
      }
      if(strstr(s,"this") || strstr(s,"that") || strstr(s,"the")){
	cout << s << endl;
	break;
      }
    }
  }
}

C++: #include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
	int f = 0,i;
	for(;;){
		char word[100]={0};
		for(i=0;;i++){
			if(scanf("%c",&word[i]) == EOF){f = 1;word[i]=10; break;}
			if(word[i] == 10){break;}
		}
		for(;;){
			for(i=0;i<(int)strlen(word);i++){
				if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'i' && word[i+3] == 's' && word[i+4] == ' '){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'a' && word[i+3] == 't' && word[i+4] == ' '){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'e' && word[i+3] == ' '){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'i' && word[i+3] == 's' && word[i+4] == '\n'){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'a' && word[i+3] == 't' && word[i+4] == '\n'){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'e' && word[i+3] == '\n'){break;}
			}
			if(i != (int)strlen(word)){cout<<word;break;}
			for(i=0;i<(int)strlen(word);i++){
				if(word[i]==122){word[i]=97;}
				else if(word[i]>=97 && word[i]<122){word[i]++;}
			}
		}
		if(f == 1){break;}
	}
	return 0;
}

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

using namespace std;

bool CheckText(string x)
{
    if(x.find("this") < x.length())
    {
        return false;
    }
    else if(x.find("the") < x.length())
    {
        return false;
    }
    else if(x.find("that") < x.length())
    {
        return false;
    }
    else
    {
        return true;
    }
}

int main()
{
    string Alphabet = "abcdefghijklmnopqrstuvwxyza";
    string Text;

    while(getline(cin, Text))
    {
                while(CheckText(Text))
        {
            for(unsigned int a = 0; a < Text.length(); a++)
            {
                for(int b = 0; b < 26; b++)
                {
                    if(Text[a] == Alphabet[b])
                    {
                        Text[a] = Alphabet[b+1];
                        break;
                    }
                    else if(Text[a] == ' ')
                    {
                        break;
                    }
                }
            }

        }

        cout << Text << endl;
    }

}

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

int main(){
   string str;
   bool ans=false;
   getline(cin,str);
   
   string::iterator ite=str.begin();
   
   while(1){
      //cout << str.find("the");
      if(str.find("the")<str.size()) ans=true;
      else if(str.find("this")<str.size()) ans=true;
      else if(str.find("that")<str.size()) ans=true;
      if(ans) break;
      for(int i=0;i<str.size();i++){
         if(*(ite+i)!=' '&&*(ite+i)!='.') *(ite+i)+=1;
      }
   }
   cout << str << endl;
}