String to Integer Parser

Programming Interview Medium 5 views
Back to Questions

Problem Description

A string s is provided (maybe with leading spaces and sign). Parse first integer like simple atoi. If no number, output 0.

Input Format

One line s.

Output Format

One integer.

Sample Test Case

Input:
-42 and text
Output:
-42

Constraints

Length

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next