Question: Create another method prettyBrackets that is initially just a copy of matchBrackets. Modify prettyBrackets to instead return a String. Build the result string as follows:

Create another method prettyBrackets that is initially just a copy of matchBrackets. Modify prettyBrackets to instead return a String. Build the result string as follows: i. If a character is not an opening nor closing bracket, simply ignore it and continue; ii. If a character is an opening bracket, append a number of tabs according to the current "level" or "depth" of nesting. Then append the bracket, then a newline, such as: \t\t{
For example, the first opening bracket should have zero tab characters, and the next nested opening bracket should have one tab.

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 Programming Questions!