id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-encryption > apcsaDecryptHomophonicCipher
prev  |  next  |  chance

Given a ciphertext String and an ArrayList of 26 key Strings, decrypt the characters in the ciphertext by finding the key containing each character and replacing it with the letter at the key's index (if the key at index 0 contains the character, the plaintext letter is 'A', and so forth).


Postcondition: The output String will be made of uppercase letters and spaces only - and because spaces are not encrypted by this algorithm, you know that the substitution keys cannot contain spaces either.

apcsaDecryptHomophonicCipher("+0123456789012= *?AB!", ["0123456789", "b", "c", "d", "AB", "f", "g", "h", "i", "j", "k", "l", "m", "!", "o", "p", "*", "r", "=", "t", "?", "v", "w", "x", "+", "z"]) → "YAAAAAAAAAAAAAS QUEEN"
apcsaDecryptHomophonicCipher("60718293h465", ["a", "b", "c", "d", "012345", "f", "g", "6789h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]) → "HEHEHEHEHEHE"
apcsaDecryptHomophonicCipher("0Cm!m!m!m!m!m!m!m", ["Z.", "+2n", "u}>E", "M", "m!", "{c7:P", "D", "C1|ep", "L_", "$%3w", "Wd)", "o", "&(<", "v", "94YU", "=Bh", "5Ix8", "y", "6", "XaR*", "#jF[", "sAkz", "0b,;", "i", "O", "TJ"]) → "WHEEEEEEEEEEEEEEE"

...Save, Compile, Run (ctrl-enter)

public String apcsaDecryptHomophonicCipher(String ciphertext, ArrayList<String> keys) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 320

Copyright Nick Parlante 2017 - privacy