Read n eight-character plates and print each one that matches a fixed pattern of digits and a capital letter, in input order.
Easy2StringImplementationBrute forceInterviewNo attempts yetTime limit2sMemory limit512 MBA crowded city has a traffic camera at every intersection. Each camera photographs the plate of any car that runs a red light. The enforcement department needs a program that processes all the recorded plates and issues a ticket for every car that broke the law. An image processing module has already read the plates from the recordings into a file, so only the ticketing module is left to write. The trouble is that the image processing module is not perfect, so some of the plates it reports are wrong.
A correct plate satisfies all of the following conditions.
The first line contains the number of plates n reported by the image processing module. It holds that 1≤n≤1000.
Each of the next n lines contains one recognized plate. Every such line consists of exactly 8 characters, each a digit or an English letter.
Print the plates that broke the law, one per line, in the order they appear in the input. If the same plate broke the law several times, print it once for each violation. Do not print a wrongly recognized plate, meaning one that fails at least one of the conditions above. If there is nothing to print, print nothing.