Print Sum of DigitsEasy

Print Sum of Digits

EasyPractice library · +10 XPdynamic programmingbasic programming

Given a positive integer N, print the sum of its digits. For example, if N = 123, the sum of digits is 1 + 2 + 3 = 6.

Input

A single line containing a positive integer N.

Output

A single line containing the sum of the digits of N.

Constraints

1 <= N <= 10^9

Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests

Example 1

Input
123
Output
6

The sum of digits for 123 is 1 + 2 + 3 = 6.

Example 2

Input
98765
Output
35

The sum of digits for 98765 is 9 + 8 + 7 + 6 + 5 = 35.

Hints