Two numbers arrive as text (for example from a form on a web page). Write add_strings(a, b) that returns their sum as an integer.
Examples
Input: a = "12", b = "30"
Output: 42
Input: a = "-5", b = "5"
Output: 0
Constraints
- Each string holds a valid integer between
-10**12and10**12, possibly with a leading-.
Goals
- Recognise that '12' + '30' is not 42
- Convert strings to int before doing arithmetic