The Turing Machine compares the two symbols at the ends and erases them if they are identical, or stops otherwise.