Question: Given a user inputted String write a recursive method (no loops) to clean the String. A cleaned String is one where only adjacent characters that

Given a user inputted String write a recursive method (no loops) to "clean" the String. A "cleaned" String is one where only adjacent characters that are the same have been reduced to a single char. So "yyzzza" yields "yza". You should call your method cleanString.

For Example:

cleanString("yyzzza") -> "yza"

cleanString("ggoonnee") -> "gone"

cleanString("Hello") -> "Helo"

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!