DWITE Online Computer Programming Contest

ROT13 Encryption

April 2010
Problem 1

ROT13, as in “rotate by 13”, is a really simple cipher algorithm that just advances every letter by 13 places, wrapping around from Z to A. Since applying the algorithm twice would advance each letter by 26 places, it has a really neat property that encryption and decryption are the same function.

The input file DATA1.txt will contain 5 lines, each being a string that is 1 ≤ N ≤ 250 characters long.

The output file OUT1.txt will contain 5 lines – corresponding strings that were run through the ROT13 function once.

Note: The character rotation should apply only to alphabetic characters. Spaces, digits, and punctuation should stay as is.

Sample Input (first two shown):
EBG13 FNZCYR.
ROT13 SAMPLE.
Sample Output (first two shown):
ROT13 SAMPLE.
EBG13 FNZCYR.