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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!