By , Silva A. M. Brazil
An educational institution has as a practice to assign access password to the academic portal to use the RA (academic record) of the student. In this institution RA's are 20-character strings always initialized by the characters "RA" and followed by 18 numeric digits. for example: RA000000000000012340. These identifiers are automatically generated by the registration system and are formed by three main parts: (a) initialized by the characters "RA", (b) followed by Z zeros which are position formatters (where, 0 <= Z <= 17 ), and finally, (c) the student's own identification number, considering the X numbers to the right of the RA not initiated by zero (where, 1 <= X <= 18).
The first entry line is an integer value N (1 <= N <= 1000) that represents the amount of RA's that the program must account for. The following N lines each represent strings of up to 100 characters representing the RAs sent by the registration system.
The valid outputs for the program are: the presentation of the provisional password or the indication of "INVALID DATA". The temporary password is made up of the X numeric characters not started at 0 to the right of the string, for example: for the identifier "RA000000000000012340" the temporary password must be "12340". If the received string does not conform to the training rules, the program should indicate "INVALID DATA".
|Input Samples||Output Samples|