Straight forward implementation of my plan. Found two bugs that were my mistakes:
- Typo on when to decrement the counter, I used “)” instead of “(“
- When using the split() function I didn’t know I had to escape the “)” character because it is a reserved character. The more you know.
Otherwise it works well. I made sure to keep the functions that do the work,
print(), separate from
main() which should make using a JUnit test to check it rather than calling it from
main(). I should really learn how to use JUnit tests. Maybe tomorrow.