#K67927. Determine Directory by Serial Number Prefix
Determine Directory by Serial Number Prefix
Determine Directory by Serial Number Prefix
You are given a serial number as a string. Your task is to determine the directory where the item should be stored based on the prefix (the first character) of the serial number. First, convert the first character to uppercase and then apply the following rules:
- If the uppercase character is between A and M (inclusive), the directory is A.
- If it is between N and T (inclusive), the directory is B.
- If it is between U and Z (inclusive), the directory is C.
If the first character is not an English letter, you must output the error message Invalid serial number format
.
Note: All boundaries are defined in terms of their ASCII values with the letters treated in uppercase. All formulas (e.g. the ranges) should be interpreted in \( \text{[A, M]}, \text{[N, T]}, \text{[U, Z]} \) notation.
inputFormat
The input consists of a single line containing the serial number (a non-empty string) read from standard input.
outputFormat
Output a single line containing one of the following:
- A, B, or C if the serial number is valid.
- The exact error message
Invalid serial number format
if the input is invalid.
AC12345
A