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 <complex>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>

using namespace std;

string rotate(string str) {
    for (int i = 0; i < str.size(); i++) {
        if ('a' <= str[i] && str[i] < 'z')str[i]++;
        if (str[i] == 'z')str[i] = 'a';
    }
    return str;
}

int main() {
    string str;
    while(getline(cin, str)) {
        for (int i = 0; i < 26; i++) {
            str = rotate(str);
            string tmp;
            bool flg = false;
            for (int i = 0; i < str.size(); i++) {
                if (str[i] != '.')tmp += str[i];
            }
            stringstream ss(tmp);
            while(ss >> tmp) {
                if (tmp == "the" || tmp == "this" || tmp == "that")flg = true;
                break;
            }
            if (flg) {
                cout << str << endl;
                break;
            }
        }
    }
    return 0;
}

C++: #include <stdio.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string.h>
using namespace std;
int main(void)
{
	int n, m, A = 0, B = 0, l, a[100] = { 0 }, b[100] = { 0 }, i = 0, j;
	char str[100] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"}, XML[1001] = { NULL }, poj[1001] = { NULL };
	scanf("%s", XML);
	for (i = 0; i < strlen(XML); i++) {
		for (n = 0; n < 26; n++) {
			if (XML[i] == str[n]) {
				poj[i] = str[n + 23];
			}
		}
	}
	

		printf("%s\n", poj);
}

C++: #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main() {
	string a="";
	while (getline(cin, a)) {
		string b;
		int z=0,sum=0;
		for (int i = 0; i < a.length(); i++) {
			if (a[i] == ' ' || a[i] == '.' || a[i] == ',') {
				b = a.substr(z, i-z);
				int t = (int)'t';
				string c = "";				
				if (b.length() == 3 || b.length() == 4) {
					c = "";
					int w = t - (int)b[0];
					for (int i = 0; i < b.length(); i++) {
						int d = (char)((int)b[i] + w);
						if (d > 'z')
							d -= 26;
						else if (d < 'a')
							d += 26;
						c += (char)d;
					}
					if (c == "the" || c == "that" || c == "this") {
						sum = w;
						break;
					}
				}
				z = i + 1;
			}
		}
		string f = "";
		for (int i = 0; i < a.length(); i++) {
			if (a[i] != ' ' && a[i] != '.' && a[i] != ',') {
				int g = (int)a[i] + sum;
				if (g > (int)'z')
					g -= 26;
				else if (g < (int)'a')
					g += 26;
				f += (char)g;
			}
			else {
				f += a[i];
			}
		}
		cout << f << endl;
		int h=0;
		cin >> h >> h;
	}
}

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(&input_str, shift, 1);
      if (FindTarget(input_str))
        break;
      Shift(&input_str, shift, -1);
      shift++;
    }
    cout << input_str << endl;
  }

  return 0;
}

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

int main(void){
  int len, cnt;
  string str;

  getline( cin, str );
  if( str[str.size()-1] == '\n' )
    str.erase(str.size()-1);
  if( str[str.size()-1] == '\r' )
    str.erase(str.size()-1);

  len = str.length();
  cnt = 0;

  while(true){
    if( str.find("the", 0) != string::npos
	|| str.find("this", 0) != string::npos 
	|| str.find("that", 0) != string::npos
	)
      break;
    for(int i = 0; i < len; i++){
      if( 'a' <= str[i] && str[i] <= 'z' ){
	str[i]++;
	if(str[i] > 'z')
	  str[i] = 'a';
      }
    }

    cnt++;
    if(cnt > 30)
      break;
  }
  
  cout << str << endl;

  return 0;
}

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

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

int main(){
	string str[80];
	int shi_rate;
	int p;
	bool flag, shifted;
	
	p = 0;
	shifted = false;
	while(!flag){
		cin >> str[p];
		//if(str[p] == "\n") break;
		
		if(str[p][str[p].size() - 1] == '.') flag = true;
		else flag = false;
		
		if(!flag && !shifted){
			if(str[p].size() == 3){
				if(str[p][2] - str[p][1] == -3 && str[p][0] - str[p][1] == 12){
					shi_rate = str[p][0] - 116;
					shifted = true;
				}
			}
			else if(str[p].size() == 4){
				if(str[p][0] - str[p][1] == 12 &&
				 ((str[p][0] == str[p][3] && str[p][3] - str[p][2] == 19) ||
				  (str[p][3] - str[p][2] == 10 && str[p][2] - str[p][1] == 1))){
					shi_rate = str[p][0] - 116;
					shifted = true;
				}
			}
		}
		else if(flag && !shifted){
			if(str[p].size() == 4){
				if(str[p][2] - str[p][1] == -3 && str[p][0] - str[p][1] == 12){
					shi_rate = str[p][0] - 116;
					shifted = true;
				}
			}
			else if(str[p].size() == 5){
				if(str[p][0] - str[p][1] == 12 &&
				 ((str[p][0] == str[p][3] && str[p][3] - str[p][2] == 19) ||
				  (str[p][3] - str[p][2] == 10 && str[p][2] - str[p][1] == 1))){
					shi_rate = str[p][0] - 116;
					shifted = true;
				}
			}
		}
		p++;
	}
	
	for(int i = 0; i < p; i++){
		for(int j = 0; j < str[i].size(); j++){
			if(str[i][j] != '.') cout << (char)((str[i][j] - 71 - shi_rate) % 26 + 97);
			else cout << '.';
		}
		if(i < p - 1) cout << " ";
		else cout << endl;
	}
	//cout << shi_rate << endl;
	
	return 0;
}

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

//メイン関数
int main()
{
  char str[81];
   while(fgets(str,sizeof(str),stdin)!=NULL){
  // while(scanf("%[^/n]s",str)!=EOF){

    //strstrで探索
  if((strstr(str,"the")) || (strstr(str,"this")) || (strstr(str,"that"))){
    puts(str);
    continue;
  }
  int len=strlen(str);
    for(int i=1;i<=26;i++){
      for(int j=0;j<len;j++){
	if(str[j]>='a' && str[j]<='z'){       
	  str[j]++;
	  if(str[j]=='{'){
	    str[j]='a';
	  }
	}
      }
      //strstrで探索
      if((strstr(str,"the")) || (strstr(str,"this")) || (strstr(str,"that")))break;
    }
    printf("%s\n",str);
  }
   return 0;
}