#K39277. Sum of Digits in a String

    ID: 26385 Type: Default 1000ms 256MiB

Sum of Digits in a String

Sum of Digits in a String

Given an input string that may contain alphanumeric characters and special symbols, your task is to extract all the numerical digits and calculate their sum.

Formally, if the extracted digits are \(d_1, d_2, \dots, d_n\), you should compute the sum \(S = \sum_{i=1}^{n} d_i\). If there are no digits in the string, the answer should be 0.

For example, for the string "a1b2c3", the output should be 6 because \(1+2+3=6\).

inputFormat

The input consists of a single line containing a string. The string may include letters, digits, and special characters.

outputFormat

Output a single integer which is the sum of all numerical digits extracted from the input string.

## sample
a1b2c3
6