solve(s) — implement atoi, following these steps in order:
1. Skip leading spaces.
2. Read an optional + or - sign (no sign means positive).
3. Read digits until the first non-digit or the end of the string. Everything after is
ignored. If there are no digits, the result is 0.
4. Clamp to the signed 32-bit range [-2147483648, 2147483647].
Do not use parseInt, Number() or int(). Clamp *while* reading digits, so a very long digit
string cannot overflow.
Examples
solve("42") → 42
solve(" -042") → -42
solve("1337c0d3") → 1337
solve("0-1") → 0
solve("-91283472332") → -2147483648
solve("words and 987") → 0Sample tests