#include <iostream>
#include <string>
std::string Encrypt(std::string, int);
int main(int argc, char *argv[])
{
std::string original = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string expected = "XYZABCDEFGHIJKLMNOPQRSTUVW" ;
std::string output = Encrypt(original,23) ;
if ( output != expected )
{
std::cout << "Output \"" << output << "\" differed from expected \""
<< expected << "\"\n" ;
}
else
std::cout << "Ouput matched expected.\n" ;
}
std::string Encrypt(std::string Source, int Key)
{
std::string Crypted = Source;
for(int Current = 0; Current < Source.length(); Current++)
Crypted[Current] += Key;
return Crypted;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKCnN0ZDo6c3RyaW5nIEVuY3J5cHQoc3RkOjpzdHJpbmcsIGludCk7CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKQp7CglzdGQ6OnN0cmluZyBvcmlnaW5hbCA9ICJBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWiI7CglzdGQ6OnN0cmluZyBleHBlY3RlZCA9ICJYWVpBQkNERUZHSElKS0xNTk9QUVJTVFVWVyIgOwoKCXN0ZDo6c3RyaW5nIG91dHB1dCA9IEVuY3J5cHQob3JpZ2luYWwsMjMpIDsKCQoJaWYgKCBvdXRwdXQgIT0gZXhwZWN0ZWQgKQoJewoJICAgIHN0ZDo6Y291dCA8PCAiT3V0cHV0IFwiIiA8PCBvdXRwdXQgPDwgIlwiIGRpZmZlcmVkIGZyb20gZXhwZWN0ZWQgXCIiCgkgICAgCTw8IGV4cGVjdGVkIDw8ICJcIlxuIiA7Cgl9CgllbHNlCgkJc3RkOjpjb3V0IDw8ICJPdXB1dCBtYXRjaGVkIGV4cGVjdGVkLlxuIiA7Cn0KCnN0ZDo6c3RyaW5nIEVuY3J5cHQoc3RkOjpzdHJpbmcgU291cmNlLCBpbnQgS2V5KQp7CiAgICBzdGQ6OnN0cmluZyBDcnlwdGVkID0gU291cmNlOwoKICAgIGZvcihpbnQgQ3VycmVudCA9IDA7IEN1cnJlbnQgPCBTb3VyY2UubGVuZ3RoKCk7IEN1cnJlbnQrKykKICAgICAgICBDcnlwdGVkW0N1cnJlbnRdICs9IEtleTsKCiAgICByZXR1cm4gQ3J5cHRlZDsKfQoK