This is a rot-n (rotate n times) encrypt/decrypt algorithm, where n can be any integer (+/-).
It's written to encrypt/decrypt all the alphabets (upper/lower case) and leaving behind all non-alphas.
rot-n where n is the key, is given in the first line of input file.
Everything is working fine. I just need help in optimizing it.
Challenge description
Your submission will be tested against an input file that contains ASCII characters. The input file starts at the very first line with a N-digits positive or negative integer number that is your cipher, followed by a new-line character. The second line starts with the payload of the encrypted text until the end of file. Note that only words (alphanumeric sequences) are encrypted and that every other character (i.e. punctuation) must not be processed by your algorithm and must also be copied ‘as is’ to the standard output.*
It's and rot-n(rotate n times) encrypt/decrypt algorithm where n can be any integer(+/-) It's written to encrypt/decrypt all the alphabets (Upper/lower case) and leaving behind all non-alpha's
rot-n where n is the key, is given in the first line of input file.
Everything working fine, Need help in optimizing it.
FYI, Puzzles description is
Your submission will be tested against an input file that contains ASCII characters. The input file starts at the very first line with a N-digits positive or negative integer number that is your cipher, followed by a new-line character. The second line starts with the payload of the encrypted text until the end of file. Note that only words (alphanumeric sequences) are encrypted and that every other character (i.e. punctuation) must not be processed by your algorithm and must also be copied ‘as is’ to the standard output.