HCLTech interview question

remove consecutive duplicate characters in a string