#K10746. Digit Sum Calculation
Digit Sum Calculation
Digit Sum Calculation
Given a non-negative integer represented as a string, your task is to compute the sum of its individual digits. For example, if the input string is "12345"
, the output should be 15
(since 1+2+3+4+5 = 15).
Note that the input is provided as a string and may contain leading zeros. Your solution must read from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The input consists of a single line containing a non-negative integer represented as a string. The string may include leading zeros. For example:
12345
outputFormat
Output a single integer representing the sum of all digits in the input string. For the example above, the correct output is:
15## sample
12345
15