about | help | code help+videos | done | prefs |
Write a method that returns a string with all of the 'replace' characters replaced with 'replaceWith', UNLESS 'avoid' appears directly in front of, or after the character. Note that there are three strings, 'replace', 'avoid', and 'replaceWith' which you may assume contain exactly one character each as a precondition. The String 'orig' can be any length. smaugChompsAdvanced1("all apes are eating apples", "a", "t", "Z") → "Zll Zpes Zre eating Zpples" smaugChompsAdvanced1("This is it if you itch", "i", " ", "-") → "Th-s is it if you itch" smaugChompsAdvanced1("Testing is so fun", "n", "g", "L") → "Testing is so fuL" ...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: 290
Copyright Nick Parlante 2017 - privacy