Time limit
1s
Memory limit
128 MB
An Alberta license plate has two parts, as in ABC-0123: three letters followed by four digits.
A license plate is good if the absolute difference between the value of its letter part and the value of its digit part is at most 100.
The value of the letter part is computed by treating the three letters like a base-26 number. A is 0, B is 1, ..., and Z is 25. For example, the value of ABC is 0 * 26^2 + 1 * 26 + 2 = 28. Therefore, ABC-0123 is good because |28 - 123| <= 100.
Given several license plates, write a program that determines whether each one is good.
The first line contains the number of license plates N. (1 <= N <= 100)
Each of the next N lines contains a license plate in the format LLL-DDDD. Each L is an uppercase English letter, and each D is a digit.
For each license plate, print nice if it is good, or not nice otherwise, one result per line.