#C7125. Nested List Sum

    ID: 50962 Type: Default 1000ms 256MiB

Nested List Sum

Nested List Sum

This problem requires you to compute the sum of all integers in a nested list. The list may contain integers or other nested lists. You must write a program that reads a single input line—a valid JSON representation of a nested list—and outputs the sum of all the integers within.

For instance, given the list [[1,2,[3,[4,5]]],6], the correct output is 21.

inputFormat

A single line containing a valid JSON representation of a nested list of integers. For example: [1, [2, 3], 4].

outputFormat

Output a single integer — the sum of all integers in the nested list.## sample

[1,2,3,4,5]
15