Question: Hi there! I need help with the following java program, Given a user inputted String come up with recursive method (no loops) to clean the

Hi there!

I need help with the following java program,

Given a user inputted String come up with 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 methodcleanString.

For Example:

  • cleanString("yyzzza")-> "yza"
  • cleanString("ggoonnee")-> "gone"
  • cleanString("Hello")-> "Helo"

Input

 n, where n is a String 

Sample Input

 yyzzza 

Output

 A "cleaned" String 

Sample Output

 yza 

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!