Practice ยท 2 of 6
Collapse adjacent duplicates
CHALLENGE
Difficulty: intermediate+25 XP
Remove **consecutive** duplicate characters, keeping the first of each run ("aabbca" โ "abca"). Only *adjacent* equal characters collapse; non-adjacent duplicates stay. Implement process(String s).
Examples: "aabbca" โ "abca", "" โ "", "aaa" โ "a".
Press Submit to check your solution.
Back to lesson: Practice: String lab: transformations under constraints