rewrite leetcode atoi