sequentially Scan the string and judge, AC