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

for example, i have 2 variables with next data “34499AAQQQ431”, “122qqe3312qe3” and i need to delete previous character when it the same as next character