//ROT13 Encryption only for captial letters
//By ~DreamVB~

#include <iostream>
#include <vector>

using namespace std;
using std::cout;
using std::endl;

string Rot13(string s){
	string s_buffer;
	vector<char>stk;

	int i = 0;

	while (i < s.length()){
		if ((s[i] < 65) || (s[i] > 90)){
			stk.push_back(s[i]);
		}else if (s[i] > 77){
			stk.push_back(s[i] - 13);
		}
		else{
			stk.push_back(s[i] + 13);
		}
		i++;
	}

	i = 0;
	
	while (i < stk.size()){
		//Build string
		s_buffer += stk[i];
		i++;
	}

	return s_buffer;
}

int main(int argc, char *argv[]){
	string s_test = "THIS IS TOP SECRET";
	string s0 = "";

	//Encrypt
	s0 = Rot13(s_test);

	cout << "Original      : " << s_test.c_str() << endl;
	cout << "Encrypted     : " << s0.c_str() << endl;
	//Decrypt
	s0 = Rot13(s0);

	cout << "Decrypted     : " << s0.c_str() << endl;

	//Clear up
	s0.clear();
	s_test.clear();

	system("pause");
	return 0;
}