Hong Kong Identity card
Difficulty: Basic
Last updated
Difficulty: Basic
Last updated
The Hong Kong Identity Card consists of 1 English letter and 6 numeric digits. A check digit, which could be 0 to 9 or A, is appended in brackets. It is calculated as follows:
For letters, A is converted to value 1, B to value 2, and so on.
For every HKID number , the sum is .
The check digit c shall be the smallest non-negative integer such that . If c is 10, A is used instead.
Write a program to determine if the Identity Card is valid.
A line which consists of the format .
Output 'YES' if the card is valid, otherwise, output 'NO'.
True
C876300(0)
false