Ah, you could fold with Stack<String>() as t...
# codereview
d
Ah, you could fold with Stack<String>() as the base case? I’m not sure that it’s any clearer, and some of the code would have to be shuffled around to return the current stack from each iteration.