#K45152. Clean Number String
Clean Number String
Clean Number String
In this problem, you are given a string which may contain digits, letters, spaces, and special characters. Your task is to extract all digit characters from the string and concatenate them to form a new number string. If no digit is found, output the text "Invalid Input".
More formally, given a string ( s ), compute the cleaned string ( S_{cleaned} ) as follows:
[
S_{cleaned} = \bigoplus_{c \in s} \begin{cases} c, & \text{if } c \text{ is a digit}\ \epsilon, & \text{otherwise}
\end{cases}
]
If ( S_{cleaned} ) is empty, output "Invalid Input".
inputFormat
Input consists of a single line string read from standard input (stdin). The string may include letters, digits, spaces, and special characters.
outputFormat
Output a single line string to standard output (stdout) representing the concatenation of all the digit characters extracted from the input string. If no digit is found, output "Invalid Input".## sample
abcd!@#$%
Invalid Input