Consider the following inputs:
String[] input = {"a9", "aa9", "a9a9", "99a99a"};
What would be the most efficient way to use StringBuilder to replace any digit immediately before the nine with the next letter after it in the alphabet?
After processing these inputs, the output should be:
String[] output = {"b9", "ab9", "b9b9", "99b99a"}
I scratched my head a bit and StringBuilder.setCharAt was the best method I could think of.
Any advice or suggestions would be appreciated.
source
share