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

 

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

Given an input String 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. Precondition: no lowercase letters in the plaintext, but non-letter characters are allowed and will not be substituted in the output. Note that 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.


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)

public String apcsaEncryptSubstitutionKey(String str, String key) { }

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: 310

Copyright Nick Parlante 2017 - privacy