模拟自动机思想

​ 见https://leetcode-cn.com/problems/string-to-integer-atoi/