How do I check for adjacent characters and if they match, delete one?

thank you so much