about | help | code help+videos | done | prefs |
oneTo1
Given an input String, return a new String where every occurrence of "1" is replaced by "one", and every occurrence of "one" is replaced by "1". Use ONLY String methods from the below as needed: length() ; substring(int from, int to) ; substring(int from) ; indexOf(String str) ; compareTo(String other) oneTo1("1 and one") → "one and 1" oneTo1("one1") → "1one" oneTo1("one at a time, 1 and one, 1") → "1 at a time, one and 1, one" ...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