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

349AQ431 like this, but it must be universal, different string with same result. we have 1rr33hh33, and checkk previous symbol and compare, when it the same delete one of this