DWITE '09 R6 #1 - ROT13 Encryption

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
DWITE Online Computer Programming Contest, 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 will contain 5 lines, strings 1 \leq N \leq 250 characters long.

The output will contain 5 lines — corresponding strings that were run through ROT13 function once.

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

Sample Input

EBG13 FNZCYR.
ROT13 SAMPLE.

Sample Output

ROT13 SAMPLE.
EBG13 FNZCYR.

Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Problem Resource: DWITE


Comments

There are no comments at the moment.