Write a program that reads a sequence of subsequences of natural numbers, and prints the sum of each subsequence.
To solve this exercise, write a procedure
that reads a subsequence of natural numbers separated by |’+’| ended in comma or dot, returns the sum of the read integer numbers in the output parameter |sum|, and indicates if the read subsequence was the last sequence with the output parameter |end|. This case is detected because the las subsequence is the only one which end with a dot.
Input
Input consists of a non empty sequence of non empty subsequences of natural numbers. In each subsequence, the integer numbers are separated by |’+’|. All the subsequences end in comma, except the last one, that ends in a dot.
Output
Your program must print the sum of the elements of each subsequence in a different line.
Input
1+2+3+4+5,1000+100+10+1,7,0+42+23.
Output
15 1111 7 65