C++ 4行

class Solution {
public:
    int atoi(const char *str) {
        if(str[0] == '\0')    return 0;
        stringstream ss(str);
        int res;ss >> res;
        return res;
    }
};