You are part of a data-mining operation that only cares about numbers as data. As such, you have been assigned to write a program that gets a long chunk of text and searches for all the numbers in the text. Because your boss cares more about large numbers, he only wants you to give him the larger half of the numbers.
You are given a String[] **text**, the lines of text to be searched for numbers, and you are to find and return the larger half of the numeric substrings in **text**. Numeric substrings should never overlap, and you should always use the longest possible contiguous sequence of numbers. For instance, `"sk12345fj"` has just one numeric substring - `"12345"`. `"sk12 345fj"` has 2 - `"12"` and `"345"`. If there are an odd number of numeric substrings in **text**, you will return `(n+1)/2` strings. These numbers should be sorted in ascending order of numeric value, and returned with any leading zeros intact. If two numbers found in **text** have the same numeric value but have different numbers of leading zeros, the one with fewer leading zeros should be considered "less". It is possible for numbers to wrap across lines - if one line ends in a number and the next one begins with a number, these are consecutive parts of the same number. |