Question: reverseAll should take a String and return a String All substrings inside matching parentheses should be reversed. If the reversed portion contains matching parentheses, these
reverseAll should take a String and return a String All substrings inside matching parentheses should be reversed. If the reversed portion contains matching parentheses, these should be "re-reversed" and so on. The parentheses should still be correctly matched and nested about the different affected substrings. reverseAll("a b (c d e (f g) (h (i j k l (m n o) (p q)) r s t)) (u v w) x y z") should return "a b ((h ((p q) (m n o) l k j i) r s t) (f g) e d c) (w v u) x y z"
You are allowed to use the following from the Java API:
class String
length
charAt
class StringBuilder
length
charAt
append
toString
class Character
any method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
