Inmates on planet Elba II are making license plates for the various departments of interplanetary vehicles of
the Federation. All plates denote positive numbers using the digits '0'-'9'. No plate ever contains a leading 0.
Unfortunately, certain pairs of digits are considered obscene by different planets. Therefore, no plate can
be created that contains those adjacent sequences of digits.
The plates are ordered by the value of the positive number on them. They are then numbered by their
placement on that ordered list; this numbering is called the sequence number. Thus, the plate with sequence
number 1 has "1" on it, the plate with sequence number 9 has "9" on it, and beyond that, the
plates are determined by what digit pairs are legal. For instance, if only the digit sequence "10"
was illegal, then the plate with sequence number 10 would be "11", and the plate with sequence digit
99 would be "111".
Your task as a lowly programmer peon on Elba II is to write a method to determine the plate number, given
the set of digit pairs that are illegal and the sequence number of the plate. If there can be no
plate with that sequence number, return the empty string.
If the plate has more than 50 digits, only return the first 47 digits followed by "..." (quotes
for clarity).
The illegal digits will be given in the String[] profane. Each element of profane will contain a
sequence of digit pairs, separated by spaces.
|