import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String plainAlphabet
= "abcdefghijklmnopqrstuvwxyz"; String cipherAlphabet
= "zyxwvutsrqponmlkjihgfedcba"; String text
= "Some sensitive text that only humans must be able to read";
String encodedText
= encrypt
(plainAlphabet, cipherAlphabet, text
); System.
out.
println(encodedText
); }
plain = plain + plain.toUpperCase();
cipher = cipher + cipher.toUpperCase();
for(int i=0; i<text.length(); i++) {
char c = text.charAt(i);
int index = plain.indexOf(c);
if(index >= 0 && index < cipher.length()) {
newText += cipher.charAt(index);
} else {
newText += c;
}
}
return newText;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN0cmluZyBwbGFpbkFscGhhYmV0ID0gImFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IjsKCQlTdHJpbmcgY2lwaGVyQWxwaGFiZXQgPSAienl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmEiOwoJCVN0cmluZyB0ZXh0ID0gIlNvbWUgc2Vuc2l0aXZlIHRleHQgdGhhdCBvbmx5IGh1bWFucyBtdXN0IGJlIGFibGUgdG8gcmVhZCI7CiAKCQlTdHJpbmcgZW5jb2RlZFRleHQgPSBlbmNyeXB0KHBsYWluQWxwaGFiZXQsIGNpcGhlckFscGhhYmV0LCB0ZXh0KTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oZW5jb2RlZFRleHQpOwoJfQoJCglwdWJsaWMgc3RhdGljIFN0cmluZyBlb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