This is an advanced problem.
In Taiwan, national identification numbers are not randomly assigned. Valid national identification numbers must pass a verification process to make sure they are real ID numbers. Only those that pass this verification process are considered as valid national identification numbers.
A national ID number consists of an alphabet and 9 digits.
The unified ID number of the national identity card can be verified through the following formula:
Alphabet | Number(a1, a2) |
---|---|
A | 10 |
B | 11 |
C | 12 |
D | 13 |
E | 14 |
F | 15 |
G | 16 |
H | 17 |
I | 34 |
J | 18 |
K | 19 |
L | 20 |
M | 21 |
N | 22 |
O | 35 |
P | 23 |
Q | 24 |
R | 25 |
S | 26 |
T | 27 |
U | 28 |
V | 29 |
W | 32 |
X | 30 |
Y | 31 |
Z | 33 |
You will get many national ID numbers, and not sure of the numbers of the ID numbers.
All the valid ID numbers' alphabet will be in the range:{A - G} and uppercase.
Please validate the ID. After validating all ID numbers, rerun a string.
The string consists of all the alphabets of valid ID numbers and the sum of the numbers of valid IDs. The alphabets should be in the same order of input.
Take the example input as example:
Only the first 4 ID are valid.
A154712712 (O)
A166672796 (O)
E163326166 (O)
B117025840 (O)
456 (X)
x1234567895 (X)
C520149873 (X)
Only the first 4 IDs are correct.
The answer should be the first 4 IDs' alphabets (AAEB) combine with the sum of first 4 IDs' numbers (154712712+166672796+163326166+117025840 = 601737514)
=> AAEB601737514