Added algorithm count_while_adjacent.