#61. 字符串中数字求和
字符串中数字求和
Sum of Digits in String
Background
Congcong is learning string processing. He encountered an interesting problem that requires extracting and calculating the sum of all digits from a string.
Problem Description
Given a string, return the sum of the digits that appear in the string, ignoring all other characters. Return if there are no digits in the string.
Input Format
Input is given from Standard Input in the following format.
A single line string .
Output Format
Output is printed to Standard Output in the following format.
An integer representing the sum of all digits in the string.
Sample
aa1bc2d3
6
aa11b33
8
Chocolate
0
Sample Explanation
Sample 1: The string "aa1bc2d3" contains digits '1', '2', '3'. Their sum is . Sample 2: The string "aa11b33" contains digits '1', '1', '3', '3'. Their sum is . Sample 3: The string "Chocolate" does not contain any digits, so the sum is .
Constraints
The length of string does not exceed .