Fraud Busters

No attempts yetTime limit1sMemory limit128 MB

Problem

Far more cars drive into the center of Default City every day than there are parking spots. To stop drivers from spilling over onto the city streets, the City Council introduced parking fees. The fees are enforced by automated scanners. A scanner photographs a vehicle registration plate, reads the digits and letters printed on it, and looks that code up in the vehicle registration database, either confirming that the fee was paid or issuing a fine to the owner.

Fraud showed up as soon as the fees did. Some owners cover one or more digits or letters on their plate with pieces of paper while they park, so the current scanner cannot read the whole registration code and cannot fine them.

The City Council created the Fraud Busters Initiative (FBI) to design a way to stop this. The FBI plan is to recognize more vehicle features, such as vehicle type and color, and to drop from the candidate list any vehicle that is known to be somewhere else at that moment. That extra information narrows the search in the registration database.

You work for the FBI. Your colleagues already wrote the recognition software that analyzes vehicle features, and it hands you a list of registration codes that could belong to the scanned car. Take that list and the code read off the plate, and report every registration code that matches. The code read off the plate may have positions the scanner could not recognize.

Input

The first line contains the 9 characters of the code as read by the scanner. Each character is a digit, an uppercase English letter, or * (a star). A star marks a position the scanner could not read.

The second line contains one integer nn (1n10001 \le n \le 1000), the number of registration codes taken from the vehicle registration database.

Each of the next nn lines contains one registration code. A registration code is 9 characters long and consists of digits and uppercase English letters. All nn codes are different.

Output

On the first line print one integer kk (0kn0 \le k \le n), the number of database codes that match the code read by the scanner. Two codes match when, at every one of the 9 positions, their characters are equal or the character of the scanned code is *.

On the next kk lines print the matching codes, one per line, in the order they appear in the input.