class Solution { public: int atoi(const char *str) { if (str == NULL) return 0; long val =0, pos = 0; char ch = '