#K67157. Nested Sum
Nested Sum
Nested Sum
You are given a nested list which may contain integers and other data types. Your task is to compute the sum of all the integers present in the list, regardless of how deeply they are nested. Non‑integer items should be ignored.
The nested list is provided in a Python literal format, which could look like [1, [2, [3, 4], 5], 6]
. Use recursive techniques to traverse the list structure.
Note: All formulas or mathematical symbols should be written in \(\LaTeX\) format if needed.
inputFormat
The input consists of a single line containing a Python literal representation of a nested list.
Example: [1, [2, "string", [3, 4], 5], 6]
outputFormat
Output a single integer which is the sum of all integer elements found by recursively traversing the nested list.
## sample[1, 2, 3, 4, 5]
15