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))
    {
        for(int n=1; n<26; n++)
        {
            for(int i=0; i<s.size(); i++)
            {
                if(s[i] >= 'a' && s[i] < 'z')
                {
                    s[i]=s[i]+1;
                }
                else if(s[i] == 'z')
                {
                    s[i] = 'a';
                }
                else
                {

                }
            }
            if(  s.find("the")  != std::string::npos
              || s.find("this") != std::string::npos
              || s.find("that") != std::string::npos)
            {
                cout << s << endl;
                break;
            }
        }
    }

    return 0;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;

bool judge(string s1,int x){
  for(int i=0;i<s1.size();i++){
    if((int)s1[i]+x>122 or (int)s1[i]+x<97) return false;
  }
  if (s1.size()==4){
    if((char)((int)s1[0]+x)=='t' and (char)((int)s1[1]+x)=='h' and (char)((int)s1[2]+x)=='a' and (char)((int)s1[3]+x)=='t') return true;
    if((char)((int)s1[0]+x)=='t' and (char)((int)s1[1]+x)=='h' and (char)((int)s1[2]+x)==    'i' and (char)((int)s1[3]+x)=='s') return true;
  }
  if (s1.size()==3){
    if((char)((int)s1[0]+x)=='t' and (char)((int)s1[1]+x)=='h' and (char)((int)s1[2]+x)==    'e') return true;
  }
  return false;
}
int main(){
  vector<string> v;
  while(1){
    string s;
    cin>>s;
    if(s[s.size()-1]=='.'){
      string tmp="";
      for (int i=0;i<s.size()-1;i++){
        tmp+=s[i];
      }
      v.push_back(tmp);


      break;
    }
    v.push_back(s);
  }
  int ans=10000;
  for (int i=0;i<v.size();i++){
    for(int j=-123;j<123;j++){
      if(judge(v[i],j)){
        ans=j;
        break;
      }
    }
  }
  for(int i=0;i<v.size();i++){
    for (int j=0;j<v[i].size();j++)cout<<(char)(v[i][j]+ans);
    cout<<" ";
  }
  cout<<"."<<endl;
      
}

C++: #include<iostream>
#include<string>
using namespace std;
bool isAlpha(char ch){
  return ('a'<=ch&&ch<='z');
}
string change(string str){
  for(int i=0;i<(int)str.size();i++){
    if(isAlpha(str[i])){
      if(str[i]=='z')str[i]='a';
      else str[i]++;
    }
  }
  return str;
}
string st(string str,int x,int y){
  string res="";
  for(int i=x;i<x+y;i++)res.push_back(str[i]);
  return res;
}
int main(){
  string str;
  string a ="abcdefghi";
  int flg;
  while(getline(cin,str)){
    flg=0;
    for(int i=0;i<26;i++){
      str=change(str);
      for(int j=0;j+3<=(int)str.size();j++)
	if(st(str,j,3)=="the")flg=1;
      if(flg)break;
      for(int j=0;j+4<=(int)str.size();j++)
	if(st(str,j,4)=="this")flg=1;
      if(flg)break;
      for(int j=0;j+4<=(int)str.size();j++)
	if(st(str,j,4)=="that")flg=1;
      if(flg)break;
    }
    cout<<str<<endl;
  }
  
  return 0;
}

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; 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'){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'a' && word[i+3] == 't'){break;}
				else if(word[i] == 't' && word[i+1] == 'h' && word[i+2] == 'e'){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;
}