Registration Plates

In Romania, registration plates must be consist of exactly 3 distinct groups of letters and numbers, with each 2 consecutive groups being separated by one space character. Also, registration plates have some particular characteristics:

  1. First of all, the first character group can be either the character "B" (not "b") or any group of 2 capital letters from the English alphabet.
  2. The second group can only contain digits (0-9). Moreover, there must be exactly 2 digits in this group. The only exception is when the first group is B, in which case this group can contain either 2 or 3 digits.
  3. The last character group should always contain 3 capital letters, regardless of the values in the first 2 groups.

Being given some strings, you should output one of the messages Correct! or Incorrect! for each string, depending on whether or not the given string is a valid registration plate by the above rules.

Note: you will receive full feedback for this problem.


The first line contains N, the number of registration plates to be validated.
Each of the following N lines contains a string of characters.


For each registration plate, print on a separate line one of the messages Correct! or Incorrect!


  • 1 ≤ N ≤ 20
  • Each of the strings representing registration plates can have between 0 and 20 characters.


aB 1a Ca1
B 001 ERU
The first registration plate is valid.
The second registration plate is not valid, since none of the 3 groups respect the rules.
The third registration plate is valid.

Sponsors Gold