Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		var result string
		line := scanner.Text()
		key := make(map[string]string)

		var i int32
		for ; i < 52; i++ {
			makeKey(key, i)
			result = decode(key, line)

			if strings.Contains(result, "the") {
				break
			} else if strings.Contains(result, "this") {
				break
			} else if strings.Contains(result, "that") {
				break
			}
		}

		fmt.Println(result)
	}
}

func makeKey(key map[string]string, shift int32) {
	for i := 'a'; i <= 'z'; i++ {
		cipher := (i + shift)
		if cipher > 'z' {
			cipher = cipher%'z' + 'a' - 1
		} else if cipher < 'a' {
			cipher = cipher + ('z' - 'a') + 1
		}
		key[string(i)] = string(cipher)
	}
}

func decode(key map[string]string, cipher string) string {
	var result string
	for _, v := range cipher {
		if key[string(v)] != "" {
			result += key[string(v)]
		} else {
			result += string(v)
		}
	}
	return result
}

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

int main(int argc, const char * argv[])
{
    string word;
    while (getline(cin, word)) {
        int cnt = 0;
        for (char tmp2 = word[0]; tmp2 <= 'z'; tmp2++) {
            if (tmp2 == 't') {
                break;
            }
            cnt++;
        }
        cnt = 0;
        for (char tmp2 = word[0]; tmp2 >= 'a'; tmp2--) {
            if (tmp2 == 't') {
                break;
            }
            cnt--;
        }
        if (word[1] + cnt == 'h') {
            if (word[2] + cnt == 'e') {
                for (int i = 0; i < word.size(); i++) {
                    if (word[i] == '.') {
                
                    }
                    else if (word[i] != ' ') {
                        word[i] += cnt;
                    }
                }
            }
            if (word[2] + cnt == 'i' && word[3] + cnt == 's') {
                for (int i = 0; i < word.size(); i++) {
                    if (word[i] == '.') {
                        
                    }
                    else if (word[i] != ' ') {
                        word[i] += cnt;
                    }
                }
            }
            if (word[2] + cnt == 'a' && word[3] + cnt == 't') {
                for (int i = 0; i < word.size(); i++) {
                    if (word[i] == '.') {
                        
                    }
                    else if (word[i] != ' ') {
                        word[i] += cnt;
                    }
                }
            }
        }
        cout << cnt << endl;
        cout << word << endl;
    }

    
    return 0;
}

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

int main(){
	char input[81],str[50][81];
	int pos=0,last_pos=0,i,j,diff;
	const char cmp[3][5]={"that","this","the"};
	bool is_found=false;


	scanf("%[^\n]",input);
	for(i=0;input[i]!='\0';i++){
		if(input[i]==' ' || input[i]=='.'){
			for(j=last_pos;j<i;j++){
				str[pos][j]=input[j];
			}
			str[pos][j]='\0';
			pos++;
			last_pos=i+1;
		}
	}

	for(i=0;i<pos;i++){
		for(j=0;j<4;j++){
			diff=str[i][0]-cmp[j][0];
			for(int k=1;str[i][k]!='\0';k++){
				str[i][k]-=diff;
			}
			if(strcmp(str[i],cmp[j])){
				j=4;i=pos;
				is_found=true;
			}
		}
	}

	for(i=0;input[i]!='\0';i++){
		if(input[i]!='.' && input[i]!=' '){
			input[i]-=diff;
		}
	}

	printf("%s\n",input);

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
int _gap;char r(char g){return(g-'a'+_gap)%26+'a';}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){_gap='t'-p[0];if(r(p[1])=='h'){if(l==3){if(r(p[2])=='e'){gap=_gap;}}else if(l==4){if(r(p[2])=='i'&&r(p[3])=='s'||r(p[2])=='a'&&r(p[3])=='t'){gap=_gap;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-'a')%26+'a');}else{std::cout<<*it;}}puts("");}}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<functional>
#include<deque>
#include<string.h>
#include<ctype.h>
#include<time.h>
#include<stdlib.h>
using namespace std;

char a[85];

bool search_th(){
  bool f = false;
  for (int i = 0; i < strlen(a); i++){
    if ((a[i] == 't' && a[i+1] == 'h' && a[i+2] == 'e' && a[i+3] == '\0') ||
        (a[i] == 't' && a[i+1] == 'h' && a[i+2] == 'i' && a[i+3] == 's' && a[i+4] == '\0') ||
        (a[i] == 't' && a[i+1] == 'h' && a[i+2] == 'a' && a[i+3] == 't' && a[i+4] == '\0')){
          f = true;  break;
    }
  }
  return f;
}

int main(){
  while (cin.getline(a, sizeof(a))){
    for (int i = strlen(a); i < 85; i++){
      a[i] = '\0';
    }
    while (1){
      if (search_th() == true){
        cout << a << endl;  break;
      }
      for (int j = 0; j < strlen(a); j++){
        if (a[j] >= 'a' && a[j] <= 'y') a[j]++;
        if (a[j] == 'z')                a[j] = 'a';
      }
    }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<string.h>
using namespace std;
int main()
{
	string s;
	getline(cin, s);
	while (true){
		for (int i = 0; i < s.size(); i++){
			if (s[i] == 'z'){
				s[i] = 'a';
			}
			else if (s[i]!=' '&&s[i]!='.'){
				s[i]++;
			}
		}
		if (s.find("the") != -1)break;
		if (s.find("this") != -1)break;
		if (s.find("that") != -1)break;
	}
	cout << s << endl;
}

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

int attack(string line)
{
    static const string cmp[3] = {"the", "this", "that"};
    istringstream iss(line);

    for (string word; iss >> word;) {
        char first = word[0];
        for (string c: cmp)
            if (c.size() == word.size()) {
                int i = 1;
                for (; i < c.size(); i++)
                    if ((c[i] - 't') % 26 != (word[i] - first) % 26)
                        break;
                if (i == c.size())
                    return ('t' - first) % 26;
            }
    }

    return -1;
}

inline int rotN(int x, int n)
{
    if (isalpha(x))
        return (x - 'a' + n) % 26 + 'a';
    else
        return x;
}

int main()
{
    int rot;
    string line;

    while (getline(cin, line)) {

        rot = attack(line);

        for (auto x : line)
            cout << (char) rotN(x, rot);

        cout << endl;
    }

    return 0;
}

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

using namespace std;

void Shift(string *str, int shift, int vec) {
  for (int str_i = 0; str_i < str->size(); str_i++)
    if (!isspace((*str)[str_i]) && (*str)[str_i] != '.')
      (*str)[str_i] += vec * shift;
}

bool FindTarget(string str) {
  if (str.find("the") != string::npos ||
      str.find("this") != string::npos ||
      str.find("that") != string::npos)
    return true;
  else
    return false;
}

int main() { 
  string input_str;

  int shift = 1;
  while (getline(cin, input_str)) {
    while (1) {
      Shift(&input_str, shift, -1);
      if (FindTarget(input_str))
        break;
      Shift(&input_str, shift, 1);
      shift++;
    }
    cout << input_str << endl;
  }

  return 0;
}