Problem Statement
For the following decoding problem, assume all alphanumeric characters are arranged in a square matrix as follows: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 Given a two character string, the string is encoded according to an algorithm called encrypt(String). The way it works is if the two characters are in the same row, the string that is returned is the reverse of those two characters. Otherwise, the string returned is the two characters that would be needed to complete a rectangle, from top to bottom. Here are a few examples: TW -> WT BQ -> EN S9 -> X4 Create a class Encrypt that contains this encrypt method. Assume that the only allowable input are the alphanumeric characters in the matrix above (no lowercase letters, no spaces, no punctuation marks). Here is the method signature (be sure your method is public): String encrypt(String input)
Definition
- Class:
- Encrypt
- Method:
- encrypt
- Parameters:
- String
- Returns:
- String
- Method signature:
- String encrypt(String param0)
- (be sure your method is public)
Constraints
Examples
No public sample cases were explicitly marked for this problem in the original data.