Problem F
Garage Door Code
There have been an increasing number of laptop thefts in your area lately. After yours was recently stolen, too, you decided that you had enough and are going to do something about it! After asking around, you heard some rumors about where the stolen laptops have been hidden and you want to get your laptop back!
The rumors led you to a particular garage and you have decided to keep an eye on it to try to figure out how to get in. Over the course of the afternoon, you have seen a handful of people come, enter the garage, and then leave.
There’s a security keypad on the door. As you have watched
carefully, you have observed different people putting in the
code, but they enter different numbers of digits. You figure
out that some, maybe all, of them are pretending to intersperse
additional key presses just to confuse anyone who might be
watching them. You look up the keypad manufacturer’s webpage
and find that the keypad was designed to use codes with a
predetermined length of
Input
The first line of input contains two integers
Each of the next
Output
Determine all
On the first line, output
Sample Input 1 | Sample Output 1 |
---|---|
4 3 21302749 5230248 21076724 |
1 2024 |
Sample Input 2 | Sample Output 2 |
---|---|
5 7 0812734225 162334559 7512334755 1002394561 9321423495 81237425 47126345119 |
1 12345 |
Sample Input 3 | Sample Output 3 |
---|---|
3 3 1234 012345 11223344 |
4 123 124 134 234 |