Question: Write in Java: 3. Given a string of parentheses, write a program that uses the vertical bar ( ') and underscore ( ' ') characters
Write in Java:

3. Given a string of parentheses, write a program that uses the vertical bar ( ') and underscore ( ' ') characters to connect the matching parentheses. Input from the keyboard a string with at most 30 characters and contains only the open and close parentheses and spaces. Assume there will be at least one parenthesis in each input string. Output to the screen the string with exactly one space between parentheses. If there are any mismatched parentheses in the string, print the message "Parentheses do not match!" Otherwise, use the vertical bar and underscore characters to draw lines between matching parentheses. Each line must be at least one vertical bar in depth, but no line should be deeper than it needs to be. Follow the format illustrated in sample output below. The program must use a stack data structure. Finally, the program should ask if the user wants to run the program again (Check case). Refer to the sample output below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
