about | help | code help+videos | done | prefs |
(MEDIUM) Given an input String, "reverse" all the letter characters by swapping them with their mirror characters at the other end of the alphabet. So, 'A' becomes 'Z', 'a' becomes 'z', 'B' becomes 'Y' and so forth. Also reverse all the digits: '0' becomes '9', '1' becomes '8' etc. Notice from the data, this algorithm is its own decryptor as well because if it is run again on ciphertext, the original plaintext is restored. Yes, you could do this with 63 if statements. Please don't - you are setting yourself up for a truly miserable time with this series of exercises. Note that the input will contain both lowercase and uppercase letters, and that the case of the input letters must be preserved in the output. Characters that are neither letters nor numbers should appear unchanged in the output.HINTCharacter.isLetter, Character.isLowerCase, Character.isUpperCase, and Character.isDigit are all useful. apcsaAtbashCipher("abcd") → "zyxw" apcsaAtbashCipher("zyxw") → "abcd" apcsaAtbashCipher("AbCdEfGhIjKlMnOpQrStUvWxYz") → "ZyXwVuTsRqPoNmLkJiHgFeDcBa" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 320
Copyright Nick Parlante 2017 - privacy