Statistics

Problem Statement for "Rot13"

Problem Statement

Class Name:  Rot13
Method Name: rot13
Parameters:  String
Returns:     String

You are to implement a class Rot13, which contains a method rot13.  The method
takes
 a string representing a 'secret' message and returns an encoded message.
 The encoded
message is encoded with a cipher called rot13.

rot13 works as follows.  Each letter in alphabet is given an index based on
it's position
 in the alphabet.  a=1, b=2, c=3, ..., z=26.  Each character in
the input string is then mapped to the character 13 places to the right.  If
the end of the alphabet is reached, counting resumes at the first character of
the alphabet.  For example, the character 'a' would be mapped to 'n', 'y' would
be mapped to 'l', 'f' to 's', and so on.  The exact same process is done for
capital letters as well.  Any non-alphabetic characters should be passed on to
the output string with no manipulation.

The method signature is:
String rot13(String s)
Be sure your method is public.

s is a String of length between 1 and 50, inclusive, containing letters, digits
and the symbols !@#$%^&*()-_=+[]{}|;':,./<>?"

Examples:
"z" is encoded as "m"
"a" is encoded as "n"
"x" is encoded as "k"
"Hello world!" is encoded as "Uryyb jbeyq!"
"This is a test message." is encoded as "Guvf vf n grfg zrffntr."
"abc123<>,xyz?*$" is encoded as "nop123<>,klm?*$"

Definition

Class:
Rot13
Method:
rot13
Parameters:
String
Returns:
String
Method signature:
String rot13(String param0)
(be sure your method is public)

Constraints

    Examples


      This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: