Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func incrementByte(b byte) byte {
	if b >= 97 && b < 122 {
		return b + 1
	} else if b == 122 {
		return 97
	}
	return b
}

func main() {
	scanner.Split(bufio.ScanLines)

	for {
		line := nextString()
		if len(line) == 0 {
			break
		}
		for i := 0; i <= 26; i++ {
			decoded := []byte{}
			for j := 0; j < len(line); j++ {
				decoded = append(decoded, incrementByte(line[j]))
			}
			line = string(decoded)
			if strings.Contains(line, "the") || strings.Contains(line, "this") || strings.Contains(line, "that") {
				fmt.Println(line)
				break
			}
		}
	}
}

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

int main(){
	string str;
	while(1){
		getline( cin, str );
		if( str.length()==0 )	break;
		for( int i=0; i<=26; i++ ){
			for( int j=0; j<str.length(); j++ ){
				if( 'a'<=str[j] && str[j]<='z' ){
					str[j]++;
					if( str[j] == 'z'+1 )
						str[j] = 'a';
				}
			}
			cout << str << endl;
			if( str.find("the")+str.find("this")+str.find("that") != -3 ){
				cout << str << endl;
				break;
			}
		}
	}
	return 0;
}

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

// determine whether it is "the","this" or "that"
char is_article(string w) {
	char sh = 't' - w.front();
	for_each(w.begin(),w.end(),[sh](char &c) {
		c += sh;
		if (c > 'z') {
			c -= (char)26;
		} else if (c < 'a') {
			c += (char)26;
		}
	});
	if (w != "the" && w != "this" && w != "that") {
		sh = '\0';
	}
	return sh;
}

int main() {
	string s;
	while (getline(cin,s)) {
		istringstream stream(s);
		string w;
		char sh;
		while (stream >> w) {
			while (w.front() == '.') {
				w.erase(0,1);
			}
			while (w.back() == '.') {
				w.pop_back();
			}
			if ((sh = is_article(w)) != '\0') {
				break;
			}
		}
		for_each(s.begin(),s.end(),[sh](char &c) {
			if (c >= 'a' && c <= 'z') {
				c += sh;
				if (c > 'z') {
					c -= (char)26;
				} else if (c < 'a') {
					c += (char)26;
				}
			}
		});
		cout << s << endl;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  string str;
  getline(cin, str);
  for (int i = 0; i < 26; ++i) {
    for (char& c : str) {
      if (isalpha(c)) {
        if (c != 'z') ++c;
        else c = 'a';
      }
    }
    if (str.find("that") != string::npos || str.find("this") != string::npos || str.find("the") != string::npos) {
      cout << str << endl;
      return 0;
    }
  }
}

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

using namespace std;

int main(void)
{
    char Cipher[100],ans[100];
	int i=0,count=0;
	while (cin.getline(Cipher,sizeof(Cipher)))
	{
		memcpy(ans,Cipher,sizeof(Cipher));
		while(1)
		{
			char the[10]={'t','h','e'},ths[10]={'t','h','i','s'},that[10]={'t','h','a','t'};
			char *ans;

			if(count==25)break;
			ans=strstr(Cipher,the);
			if(ans!=NULL)break;
			ans=strstr(Cipher,ths);
			if(ans!=NULL)break;
			ans=strstr(Cipher,that);
			if(ans!=NULL)break;
			
			while(Cipher[i]!='\0')
			{
				if(Cipher[i]==' ')i++;
				if(Cipher[i]=='.')break;
				Cipher[i]=Cipher[i]++;
				if(Cipher[i]=='z') Cipher[i]='a';
				i++;
			}
			count++;
			i=0;
		}
		int number=0,i=0;
		if(count!=25)
		{
			while (Cipher[i]!='\0')
			{
				if(Cipher[i]==' ')i++;
				if(Cipher[i]=='.')break;
				number=(Cipher[i]-'a'+count)%26;
				ans[i]=number+'a';
				i++;
			}
		}
		cout<<Cipher<<endl;
		i=0,count=0;
	}
	return 0;
}

C++: #include <stdio.h>
using namespace std;
int main() {
	char st[80];
	string w[3]={"the","this","that"};
	int wn[3]={3,4,4},k,i,j,s,f,z;
	while(true) {
    k=0; z=0;
	scanf("%[^0]",st);
	z=strlen(st);
	cout << z << endl;
	while(k<z) {
		for (i=0;i<3;i++) {
			s=0; f=0;
			if (z<k+wn[i]) break;
			for (j=0;j<wn[i]-1;j++) if ((w[i][j]-w[i][j+1])==(st[k+j]-st[k+j+1])) s++;
			if (s==wn[i]-1 && (st[k+wn[i]]<'a' || st[k+wn[i]]>'z' ))  { f=1; i=5;}
		}
		if (f==1) break;
		for (k;st[k]>='a' && st[k]<='z';k++);
		k++;
		}
	if (f==0) cout << st; else {
	for (i=0;i<z;i++) if ((st[i]>='a' && st[i]<='z')) cout << (char)(st[i]-(st[k]-'t')) ; else cout << st[i];
	}	
	cout << endl;
	}
    return 0;
	}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	string s;
	while(getline(cin,s)){
		int size=s.size();
		for(int j=0;;j++){
			string ex=s;
			rep(i,size){
				if(isalpha(ex[i])){
					ex[i]=(char)(((int)ex[i]-'a'+j)%26+'a');
				}
			}
			int cnt=0;
			rep(i,size-2){
				if(ex[i]=='t' && ex[i+1]=='h' && ex[i+2]=='e'){
					cnt++;
					s=ex;
					break;
				}
			}
			rep(i,size-3){
				if(ex[i]=='t' && ex[i+1]=='h' && (ex[i+2]=='i' || ex[i+2]=='a') && (ex[i+3]=='s' || ex[i+3]=='t')){
					cnt++;
					s=ex;
					break;
				}
			}
			if(cnt>=1)break;
		}
		cout<<s<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
int main(){std::string s;while(std::getline(std::cin,s)){char b[81],*p,*c;c=b;strcpy(b,s.c_str());int gap=0;do{p=strtok(c," .\n");if(p!=NULL){int l=strlen(p);if(l>=3&&p[0]-p[1]=='t'-'h'){if(l==3){if(p[0]-p[2]=='t'-'e'){gap='t'-p[0];break;}}else if(l==4){if(p[0]-p[2]=='t'-'i'&&p[0]-p[3]=='t'-'s'){gap='t'-p[0];break;}else if(p[0]-p[2]=='t'-'a'&&p[0]-p[3]==0){gap='t'-p[0];break;}}}}c=NULL;}while(p!=NULL);for(std::string::iterator it=s.begin();it!=s.end();++it){if(*it!=' '&&*it!='.'&&*it!='\n'){std::cout<<static_cast<char>(*it+gap);}else{std::cout<<*it;}}}}

C++: #include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdlib.h>
#define inf 0x3f3f3f
using namespace std;
int main()
{
    string a;
    while(getline(cin,a))
    {
        while(a.find("the")==-1&&a.find("this")==-1&&a.find("that")==-1)
        {
            for(int i=0;i<a.size();i++)
            {
                if('a'<=a[i]&&a[i]<'z')
                    a[i]++;
                else if(a[i]=='z')
                    a[i]='a';
            }
        }
         cout<<a<<endl;
    }
   return 0;
}