about | help | code help+videos | done | prefs |
For the given input String, return an output String containing only the even-indexed characters from the original, in their original sequence. This means index 0, then index 2, then index 4 etc. HINTUse the + operator to concatenate two Strings, as well as substring() to extract smaller Strings from larger ones. Remember that in a loop with loop control variable i, getting a one-character String out of an original String means using substring(i,i+1). As for getting even indexes, there are several ways to accomplish this but two that come to mind are adding two to a loop control variable with each pass through a loop, and using the remainder % operator. 5 % 2 is 1 because 5 is odd. apcsaStringsGimmeEvens("abcdefg") → "aceg" apcsaStringsGimmeEvens("aAaAaAa") → "aaaa" apcsaStringsGimmeEvens("AaBbCcDd") → "ABCD" ...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: 200
Copyright Nick Parlante 2017 - privacy