#K15381. Extract and Sort Integers
Extract and Sort Integers
Extract and Sort Integers
You are given a list of strings. Some of these strings may contain integers embedded within them. Your task is to extract all the integers (including any negative ones) from each string and then sort the resulting integers in ascending order.
For example, from the string abc123
extract 123, and from negative-10
extract -10. If a string is a pure integer (possibly with a negative sign), then simply consider that integer.
The final sorted integers should be printed on a single line, separated by a space. If no integers can be extracted, print an empty line.
The extraction for an integer from a string can be formally represented as follows:
$$result = \{ x \in \mathbb{Z} \mid x \text{ is found in the string}\}$$
inputFormat
The first line of input contains an integer n which denotes the number of strings.
This is followed by n lines, each containing a single string.
outputFormat
Output a single line containing the extracted integers in ascending order, separated by a space.
If there are no integers to extract, output an empty line.
## sample5
abc123
98
56
hello45
32
32 45 56 98 123