Bloomberg Interview Question

Variant of remove adjacent duplicates in string ii