In Slovakia, every person is assigned a unique 10-digit string when he is born.
This string is known as the birth number of the respective person.
The birth number has the form "YYMMDDCCCC", where:
- YY are the last two digits of the year.
- For males, MM is a two-digit number of the month, i.e., a number between 01 and 12, inclusive.
For females, MM is the number of the month increased by 50, i.e., a number between 51 and 62, inclusive.
- DD is a two digit number of the day in the month.
- CCCC are four arbitrary digits that are used both as a checksum and as a way to distinguish between different people born on the same day.
The checksum property works as follows: the digits CCCC must be chosen in such a way that the entire 10-digit number is divisible by eleven (11).
For example, the strings "8104121234" and "8154121239" represent valid birth numbers.
(The first person is male, the second one female. Both of them are born on April 12th, ??81.)
The strings "8134120005", "8102310007", and "8104121235" are not valid birth numbers.
(In the first case, "34" can not be a valid month. In the second case, the day number is wrong, as the second month has less than 31 days. In the third case, the date is valid but the number is not divisible by 11.)
You will be given a String[] test containing several ten-digit strings. Write a method that will return a String[]
with the same number of elements. If the i-th element of test is a valid birth number the i-th element of the return value shall be "YES",
otherwise the i-th element of the return value shall be "NO". When checking whether the date is valid, assume that the year when the person was born is between 1907 and 2006, inclusive.
|