Comma Sum Multiline
Time limit1sMemory limit256 MB
Join the input lines into one comma-separated string, split it at commas, and print the sum of the numbers.
- Level
Easy1 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Problem
A string that consists only of digits and commas is given over several lines. The line breaks are not part of , so joining the given lines in order gives itself. Splitting at every comma yields a sequence of natural numbers. Compute the sum of those numbers.
Input
The string is given over one or more lines. Each line consists only of digits and commas.
The joined string has length at most 10,000. It does not start or end with a comma, and it never contains two commas in a row. Each comma separated number is a natural number between 1 and 1,000,000 with no leading zero.
Output
Print the sum of the natural numbers contained in on one line.