| about | help | code help+videos | done | prefs |
asterixTargetAsterixToXXX
Let's say the target is the substring between the first and second '*'. Replace all appearances of the target with "xxx" and remove all '*' characters; unless the target string contains an x or is an empty string, in which case just remove all '*' characters. If there are not at least two '*' characters in the string, then return the original string unchanged. Examples: "*why* ask why?" -> "xxx ask xxx?" 1. "why" is the target because it is between the first and second '*'. 2. '*' characters removed 3. appearances of target "why" replaced with "xxx" "*ab*c*de*abde" -> "xxxcdexxxde" 1. "ab" is the target because it is between the first and second '*'. 2. '*' characters removed 3. appearances of target "ab" replaced with "xxx" "epic *explosion*" -> "epic explosion" 1. "explosion" is the target because it is between the first and second '*'. 2. '*' characters removed 3. target "explosion" has an x, so nothing else is changed. asterixTargetAsterixToXXX("*why* ask why?") → "xxx ask xxx?" asterixTargetAsterixToXXX("*ab*c*de*abde") → "xxxcdexxxde" asterixTargetAsterixToXXX("epic *explosion*") → "epic explosion" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy