| about | help | code help+videos | done | prefs |
(MEDIUM) Given an input String (the "plaintext") and a 26-character key String, encode the input by substituting each letter of the input with the character having the same index ('A'==0, 'B'==1, ..., 'Z'==25) from the key. Preconditions: 26 characters in the key are all unique, no lowercase letters in the plaintext, but non-letter characters in plaintext are allowed and will not be substituted in the output. Note that some of the keys will have non-letter characters as well however, meaning that the output will have an increased number of non-letter characters as a result. HINT: if you don't want to use the char data type, consider using the String "ABCDEFGHIJKLMNOPQRSTUVWXYZ" in order to find what "index position" a letter of the plaintext has in the key.apcsaEncryptSubstitutionKey("ABCDE", "ZYXWVUTSRQPONMLKJIHGFEDCBA") → "ZYXWV" apcsaEncryptSubstitutionKey("HELL HATH NO FURY LIKE A SEMICOLON SCORNED", "ZYXWVUTSRQPONMLKJIHGFEDCBA") → "SVOO SZGS ML UFIB ORPV Z HVNRXLOLM HXLIMVW" apcsaEncryptSubstitutionKey("HELL HATH NO FURY LIKE A SEMICOLON SCORNED", "ABCDEFGHIJKLMNOPQRSTUVWXYZ") → "HELL HATH NO FURY LIKE A SEMICOLON SCORNED" ...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: 310
Copyright Nick Parlante 2017 - privacy