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

 

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

Given an input String and an ArrayList of code words to look for, extract all the code words in the order they are found in the input. Place them into the output String, lowercase given that the ArrayList will only have lowercase letters, with spaces between. Code words can be found with any capitalization in the plaintext, and can also be found inside of other words like "in" within "into."


HINT: One easy first step is dealing with capitalization.  The String class has nice methods toLowerCase() and toUpperCase() which may be of help here.

apcsaExtractHiddenWords("I went fishing in the sea and found a large squid.", ["squid", "fish", "found"]) → "fish found squid"
apcsaExtractHiddenWords("The finalists for runway model of the year are Cassaway Jane and Runta Fastomi", ["light", "run", "help", "attack", "eat", "fast", "away"]) → "run away run fast"
apcsaExtractHiddenWords("oneBananafish BananatwoBanana fishBananared BananafishBanana blueBananafishBanana", ["fish", "one", "two", "three", "blue", "red"]) → "one fish two fish red fish blue fish"

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

public String apcsaExtractHiddenWords(String str, ArrayList<String> codes) { }

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