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 find_cnt;
string find_str;

bool find(string str, string can) {
  string tmp_can = ' ' + can + ' ';
  string tmp_str = ' ' + str + ' ';
  int cnt = 0;
  for (int i = 0; i < tmp_str.length(); ++i) {
    if (string::npos != tmp_str.find(tmp_can, i)) {
      cnt++;
    }
  }
  if (find_cnt < cnt) {
    find_cnt = cnt;
    find_str = str;
  }
  return false;
}

int main() {
  string str;
  string candies[] = {"this", "the", "that"};
  while(getline(cin, str)) {
    find_cnt = 0;
    find_str = "";
  for (int m = 1; m < 26; ++m) {
    for (int i = 0; i < str.length(); ++i) {
      if (str[i] == ' ') {
        continue;
      }
      if (str[i] == ',' || str[i] == '.') {
        str[i] = ' ';
        continue;
      }
      if (m != 1) {
        int char_id = static_cast<int>(str[i]) - 97;
        int shifted = static_cast<int>(char_id + 1);
        str[i] = static_cast<char>(shifted % 26 + 97);
      }
    }
    for (int i = 0; i < sizeof(candies) / sizeof(candies[0]); ++i) {
      find(str, candies[i]);
    }
  }
  if (find_str != "") { 
    cout << find_str << endl;
  }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<sstream>
#include<vector>


std::vector<std::string> split(const std::string &s, char delim) {
	std::vector<std::string> elems;
	std::stringstream ss(s);
	std::string item;
	while (std::getline(ss, item, delim)) {
		if (!item.empty()) {
			elems.push_back(item);
		}
	}
	return elems;
}

int main() {
	std::string input;
	while (std::getline(std::cin, input)) {
		std::vector<std::string> words;
		bool isPeriod = false, isCipher = false;
		if (*(input.rbegin()) == '.') {
			input.pop_back();
			isPeriod = true;
		}
		words = split(input, ' ');
		for (int i = 0; i < 26; i++) {
			for (std::vector<std::string>::iterator itr = words.begin(); itr != words.end(); itr++) {
				for (std::string::iterator sitr = (*itr).begin(); sitr != (*itr).end(); sitr++) {
					*sitr = ((*sitr - 'a' + 1) % 26) + 'a';
				}
				if (*itr == "the" || *itr == "this" || *itr == "that") {
					isCipher = true;
				}
			}
			if (isCipher) break;
		}
		std::string output = "";
		for (std::vector<std::string>::iterator itr = words.begin(); itr != words.end(); itr++) {
			if (output != "") output += " ";
			output += *itr;
		}
		if (isPeriod) output += ".";
		std::cout << output << std::endl;
	}
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
  
 int main()
 {
   string a,b;
   while(getline(cin,a))
   {
     for(int shift=1;shift<26;shift++)
     {
       b="";
       for(int i=0;i<a.length();i++)
       {
         if(a[i]>='a'&&a[i]<='z')
         { 
           if(a[i]+shift>'z') b+=(a[i]+(shift-26));
           else b+=(a[i]+shift);
         }         
         else b+=a[i]; 
       }
       if(b.find("the")!=string::npos||b.find("this")!=string::npos||b.find("that")!=string::npos) break;
       else continue;
     }             
     cout<<b<<endl;
   }
   //while(1);      
   return 0;    
 }

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

int main(){
	std::string s;
	std::getline(std::cin, s);
	for (int i = 0; i < 26; ++i){
		if (s.find("this") == std::string::npos && s.find("the") == std::string::npos && s.find("that") == std::string::npos){
			for (int j = 0; j < s.size(); ++j){
				if (s[j] != ' '&&s[j]!='.'){
					if (s[j] == 'z')s[j] = 'a';
					else s[j] += 1;
				}
			}
		}
		else{
			std::cout << s << std::endl;
			break;
		}
	}
	return 0;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	string s;
	string ans;
	bool flag = false;
	int key = 1;
	while(getline(cin, s)){ans += s;}
	while(1) {
		rep(i, ans.size()) {
			if(97 <= ans[i] && ans[i] <= 122) {
				int number = (ans[i] - 'a' + key) % 26;
				ans[i] = 'a' + number;
			}
		}
		string tmp;
		rep(i, ans.size()) {
			if(97 <= ans[i] && ans[i] <= 122) tmp += ans[i];
			else if(ans[i] == ' ') {
				if(tmp == "this" || tmp == "the" || tmp == "that") flag = true;
				else tmp.erase(tmp.begin(), tmp.end());
			}
		}
		if(flag) break;
	}
	cout << ans << endl;
	return 0;
}

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

bool checkString(int* key, string s);
void rotateChar(string* s, int i);

int main()
{
    list<string> table;
    char text[80];
	int size=0;

	for(size=0; cin.get(text[size]); size++ ){;}

	char ch;
	string s;
	for(int i=0; (ch=text[i])!=EOF; i++){
		if(ch!=' ')s.push_back(ch);
		else{ table.push_back(s), s.clear();}
	}		

    int key; // ずらす文字数
    list<string>::iterator i;
    for(i=table.begin(); i!=table.end(); i++){
        // cout << *i << " ";
        if( i->size() == 3 || i->size() == 4 )
            if( checkString(&key, *i) ) break;
    }
	
	for(int i=0; i<size; i++){
		char ch = text[i];
		if(isalpha(ch)){
        char c = ch - 'a';
        ch = 'a' + (c+key)%26;
		}
		cout.put(ch);
	}

    return 0;
}

void rotateChar(string* s, int i) // iは何文字ずらしたいか
{

    for(int j=0; j<s->size(); j++){
        if(!isalpha(s->at(j))){continue;}
        char c = s->at(j) - 'a';
        s->at(j) = 'a' + (c+i)%26;
    }
}

bool checkString(int* key, string s)
{

    for(int i=0; i<26; i++){
        string tmp = s;
        rotateChar(&tmp, i);
        // cout << tmp << endl;
        if( tmp=="the" || tmp=="this" || tmp=="that" ){
            *key=i;
            return true;
        }
    }
    return false;
}

C++: #include<stdio.h>
#include<string.h>
int main(void)
{
	int i=1,x;
	char s;
	while(s=getchar()!='\n' && s!=EOF)
	{
	  if(i==1) 
	  {
		  x ='t'-s;
		  i+=1;
	  }
	  if (s>'a'&&s<'z'){
	    if(s-x<'a') 
		  s=s-x+27;
	    else 
		  s=s-x;
	  }
         printf("%s",s);
	}
  return 0;
}