Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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 scanner.Scan() {
		infos := strings.Split(scanner.Text(), " ")
		plain := make([]string, len(infos))
		// 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 <cmath>
#include <string>
using namespace std;

int CheckDiff(string);
int ShowSourceString(string,int);
int main(){
	string str;
	while(getline(cin,str)){
		ShowSourceString(str,CheckDiff(str));
	}
	
	return 0;
}

int CheckDiff(string str){
	for( int i=0;i<(int)str.length();i++ ){
		if( (abs(str[i+1]-str[i])==abs('h'-'t'))&& 
		    (abs(str[i+2]-str[i])==abs('a'-'t'))&&
		    (abs(str[i+3]-str[i])==abs('t'-'t'))
		){
			return str[i]-'t';
		}
		if( (abs(str[i+1]-str[i])==abs('h'-'t'))&& 
		    (abs(str[i+2]-str[i])==abs('i'-'t'))&&
		    (abs(str[i+3]-str[i])==abs('s'-'t'))
		){
			return str[i]-'t';
		}
		if( (abs(str[i+1]-str[i])==abs('h'-'t'))&& 
		    (abs(str[i+2]-str[i])==abs('e'-'t'))
		){
			return str[i]-'t';
		}
	}
	return 0;
}
int ShowSourceString(string str,int diff){
	for( int i=0;i<(int)str.length();i++ ){
		if('a'<=str[i]&&str[i]<='z' ){
			if(str[i]-diff>'z'){
				cout<<(char)('a'+str[i]-diff-'z'-1);			
			}else if(str[i]-diff<'a'){
				cout<<(char)('z'-('a'-(str[i]-diff))+1);			
			}else{
				cout<<(char)(str[i]-diff);
			}
		}else{
			cout<<(char)str[i];
		}
	}
	cout<<endl;
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main() {
	string str;
	while(getline(cin, str)) {
		int n = 't' - str[0];
		for(int i = 0; str[i] != '\0'; i++) {
			if(('a' <= str[i])&&(str[i] <= 'z')) {
				str[i] += n;
				if(str[i] > 'z') {
					str[i] = str[i] - 26;
				} else if(str[i] < 'a') {
					str[i] = str[i] + 26;
				}
			}
		}
		cout << str << endl;
	}
	return 0;
}

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

int main(void){
	char list[26];
	list[0]='a';
	for(int i=1;i<26;i++)
		list[i]=list[i-1]+1;
	string S;
	while(true){
		getline(cin,S);
		if(cin.eof())
			break;
		for(int i=0;i<26;i++){
			for(string ::iterator it=S.begin() ;it!=S.end();it++)
				if(islower(*it))
					*it=list[(*it-'a'+1)%26];
			if(S.find("this")!=-1||S.find("that")!=-1||S.find("the")!=-1)
				break;
		}
		cout << S <<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
vector<string> split(string &s, char delimiter){
  vector<string> res;
  int prev_split_point = 0;
  for (int i = 0; i < s.length(); i++) {
    while(s[i] != delimiter && i < s.length())i++;
    string add = s.substr(prev_split_point, i - prev_split_point);
    if(!add.empty())res.push_back(add);
    prev_split_point = i + 1;
  }
  return res;
}

int main(int argc, char *argv[]){
  char c[26];
  for (int i = 0; i < 26; i++) {
    c[i] = 'a' + i;
  }
  vector<string> vs;
  string s;
  string ans[] = {"this", "that", "the"};
  vector<string> tmp;
  while(getline(cin, s)){
    vs = split(s, ' ');
    int n = vs.size();
    vs[n - 1] = vs[n - 1].substr(0, vs[n - 1].length() - 1);
    for (int k = 0; k < 26; k++) {
      tmp = vs;
      for (int i = 0; i < vs.size(); i++) {
        for (int j = 0; j < vs[i].length(); j++) {
          tmp[i][j] = c[(vs[i][j] - 'a' + k) % 25];
        }
      }
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < tmp.size(); j++) {
          if(tmp[j] == ans[i]){k = 50, i = 10, j = 1000;}
        }
      }
    }
    for (int i = 0; i < tmp.size(); i++) {
      std::cout << tmp[i];
      if(i == tmp.size() - 1)std::cout << "." << std::endl;
      else std::cout << " ";
    }
  }
  return 0;
}

C++: 
using namespace std;



char shiftch(char p, int n){
	int t;
	if('A'<= p && p <='Z'){
		p-='A';
		if(n<0) n+=26;
		p+=n;
		p%=26;
		p+='A';
		return p;
	}
	else if('a'<= p && p <='z'){
		p-='a';
		if(n<0) n+=26;
		p+=n;
		p%=26;
		p+='a';
		return p;
	}
	else return p;
}


int checkch(char p){
	if('A'<= p && p <='Z') return 2;
	else if('a'<= p && p <='z') return 1;
	else return 0;
}


int main(){

	int	i, j, n;
	char in[1000], w[5], *p, *tp;
	p= in;

	scanf("%[^\n]", in);
	n= strlen(in);
//	printf("%d\n", n);

	while(1){
		tp=p;
		for(i=0; *(p++)!=' ';	i++);
		if(i==3||i==4){

			j=*tp-'t'; if(*(tp+1)=='h'+j) break;
			j=*tp-'T'; if(*(tp+1)=='h'+j){
			j+='a'-'A';
			break;
			}
		}
//		++p;
	}
	for(i=0; i<n; i++)	in[i]=shiftch(in[i],-j);

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

	
	
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	string str, the = " the", dis = " this", that = " that";
	int zure, count = 0, i = 0;
	string judge = " ";
	bool bo = false;
	getline(cin, str);
		for (int j = 0; j < str.size(); j++) {
			zure = str[i] - 't';
			if (str[j] != ' ' && str[j]!='.') {
				if (str[j] - zure>='a'&&str[j]-zure<='z') {
					judge += str[j] - zure;
				}
				else if(str[j]-zure>'z'){
					judge += str[j] - 26 - zure;
				}
				else {
					judge += str[j] + 26 + zure;
				}
			}
			if (str[j] == ' ' || j == str.size() - 1) {
				if (judge == " the" || judge == " this" || judge == " that") {
					bo = true;
					break;
				}
				else {
					i = j+1 ;
					judge = " ";
				}
			}
		}
	for (int i = 0; i < str.size(); i++) {
		if (str[i] >= 'a'+abs(zure) && str[i] <= 'z' - abs(zure)) {
			str[i] -= zure;
		}
		else if ((str[i]-abs(zure) < 'a' || str[i]+abs(zure) > 'z') && str[i]!=' ' && str[i]!='.') {
			if (str[i] + zure > 'z') {
				str[i] -= zure; 
			}
			else if (str[i] - zure > 'z') {
				str[i] -= 26 + zure;
			}
			else if (zure < 0) {
				str[i] -= zure;
			}
			else {
				str[i] += 26 - zure;
			}
		}
		cout << str[i];
	}
	cout << endl;
	return 0;
}

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


int main()
{
	string s, line[81];
	while (getline(std::cin, s)){
		fill(line, line + 81, "");
		int counter = 0;
		s += "\n";

		//入力内容を配列にとる．
		string word = "";
		for (int i = 0; i < (signed)s.length(); i++){
			if (s[i] == ' ' || s[i] == '\n'){
				line[counter++] = word;
				word = "";
			}
			else{
				word += s[i];
			}
		}



		//ずらす数を探す
		int slide;
		for (int i = 0; i <= 26; i++){
			for (int j = 0; j < counter; j++){
				string word = "";
				for (int k = 0; k < (signed)line[j].length(); k++){
					if (line[j][k] != '.' && line[j][k] != ' '&& line[j][k] != '\n'){
						word += 'a' + (line[j][k] + i - 'a') % 26;
					}
					else{
						word += line[j][k];
					}
				}
				if (word == "the" || word == "this" || word == "that"){
					slide = i;
					goto jump;
				}

			}
		}

	jump:

		//ずらすべき数だけずらす
		for (int i = 0; i < counter; i++){
			for (int j = 0; j < (signed)line[i].length(); j++){
				if (line[i][j] != '.' && line[i][j] != ' '&& line[i][j] != '\n'){
					line[i][j] = 'a' + (line[i][j] + slide - 'a') % 26;
				}
			}
		}

		//出力
		for (int i = 0; i < counter - 1; i++){
			cout << line[i] << " ";
		}
		cout << line[counter - 1] << endl;

	}
	return 0;
}