The Phone Number Mess
Hollis Telecom imports contact numbers from a dozen different sources and no two of them agree on punctuation: one writes 555-123-4567, another (555) 123 4567, a third 5551234567. The dialler needs a bare run of digits, because all that punctuation is decoration for human eyes and means nothing to a switch. Two records that look completely different on screen are very often the same phone number underneath.
Task: Print each contact number with everything except its digits removed.
Input
The first line holds one integer n, how many contact numbers follow. Each of the next n lines holds one number, which may contain any mixture of digits, spaces, dashes, round brackets, dots and a leading plus sign.
Output
n lines in the same order, each holding only that number's digits, in the order they appeared, with nothing at all between them.
Example:
Input:
3
555-123-4567
(555) 123 4567
5551234567
Output:
5551234567
5551234567
5551234567
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in