Question: 6 . The Remove Duplicates Method TO DO: 1 . Write a method to remove consecutive duplicate characters from a String. If two or more

6. The Remove Duplicates Method
TO DO:
1. Write a method to remove consecutive duplicate characters from a String.
If two or more consecutive duplicate characters have different cases, then the first letter should be kept.
When you run this method, your output should look like this:
Testing the dedupeChars method
dedupeChars("a") should be a -> a
dedupeChars("aa") should be a -> a
dedupeChars("MiSsisSiPpi") should be MiSisiPi -> MiSisiPi
dedupeChars("swimMmMming") should be swiming -> swiming

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!