Meta interview question

find common ancestor; delete adjacent duplicate characters