#C12887. Extract Digits from a String

    ID: 42363 Type: Default 1000ms 256MiB

Extract Digits from a String

Extract Digits from a String

You are given a single line input string that contains a mix of letters, digits, and other symbols. Your task is to extract all the digits from the string in the order they appear and output them as an integer. If no digits are found, output 0.

The extraction is performed by concatenating every digit found in the string. Note that if the concatenated number has leading zeros (for example, '00'), it should be treated as an integer, hence 00 becomes 0, and 000123 becomes 123.

Formally, if the input string is denoted by \(s\), let \(D\) be the sequence of all characters \(c\) in \(s\) such that \(c\) is a digit. The output is then given by:

[ \text{result} = \begin{cases} \text{integer formed by concatenating all characters in } D, & \text{if } D \neq \emptyset, \ 0, & \text{if } D = \emptyset. \end{cases} ]

inputFormat

The input consists of a single line containing a string. The string may be empty or contain spaces, letters, digits, and symbols.

outputFormat

Output a single integer which is obtained by concatenating all the digit characters found in the input string. If there are no digits in the input string, output 0.

## sample
abc123
123