Convert the start of the string s to a whole number, following these rules in order:
+ or -, read it as the sign (no sign means positive).0 to 9) until the first character that is not a digit or the end of the string. Ignore everything after that.0.-2**31 return -2**31, if above 2**31 - 1 return 2**31 - 1.Example 1
Input:
my_atoi('42')
Output:
42
The digits 42.
Example 2
Input:
my_atoi(' -42abc')
Output:
-42
Spaces skipped, sign -, digits 42, then abc ignored.
Example 3
Input:
my_atoi('words 987')
Output:
0
The first character is a letter, so no digit is read: 0.
0 <= len(s) <= 3 * 10**5s contains letters, digits, spaces, + and -.No results yet
Run your code to check it against the examples, or submit to run every test.