Question: 9) Write a recursive function (static method) called parenCleaner that takes a String as a parameter, and returns a new String where all of the

9) Write a recursive function (static method) called parenCleaner that takes a String as a parameter, and returns a new String where all of the open parentheses (i.e. () have been moved to the beginning of the String and all of the closed parens (i.e. )) have been moved to the end of the String. This example question may help with this question (this is probably easier than you think). For example:

parenCleaner(x()y()z(a)) => (((xyza)))

parenCleaner(f(x,y,z)) => (fx,y,z)

parenCleaner(pumpkins) => pumpkins

public static String parenCleaner(String str) {

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!