#C11945. Sum of Odd Numbers
Sum of Odd Numbers
Sum of Odd Numbers
You are given a single line of input which represents a list of integers. The input can either be the string None
(indicating that the list is empty) or a sequence of integers separated by spaces.
Your task is to compute the sum of all odd numbers in the list. In mathematical notation, you need to compute
$$\sum_{i: a_i \text{ is odd}} a_i.$$
If the list is empty or the input is None
, output 0.
The input should be read from stdin and the result must be printed to stdout.
inputFormat
The input consists of a single line which is either the string None
or a space-separated list of integers. For example:
1 2 3 4 5
outputFormat
Output a single integer denoting the sum of all odd numbers from the input list.
## sample1 2 3 4 5
9