87. Convert a String to an Integer
Core1000 ms256 MBSolved by 0%
Read one line containing an integer written as text, and print it as a number.
The text may begin with a - sign. Do the conversion yourself, character by character,
rather than calling a built-in parser, that is the exercise.
The input is always a valid integer with no spaces or other characters.
Constraints - The value is between `-1000000000000000000` and `1000000000000000000`.
Input
A single line of text.
Output
Print one integer, the value of the digits, without calling a built-in parser.
Input1234
Output1234
Noteis a plain positive number
Input-567
Output-567
Notebegins with a minus sign, which must not be treated as a digit
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.