Question: 5. editout should take a String as input and output a String. You may assume the input String has properly matched parentheses. The behavior for

5. editout should take a String as input and output a String. You may assume the input String has properly matched parentheses. The behavior for improperly matched parentheses is up to you, but the method should not crash. The output String should be identical to the input string except that any text inside a pair of matched parentheses is removed, including the parentheses. In addition if there is a pair of matched parentheses inside the removed text, that text should be retained (though the parentheses should be removed). If there are any matched parentheses inside the retained text, that text should be removed, and so on editout("this is an (unusual (example)) of (editing out and (retaining)) text") should return "this is an example of retaining text" editout ("this is (another) (example) showing (((((removal))))) -( and ). ((((retention))))") should return "this is showing .. retention
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
