#C7236. Employee ID Validator
Employee ID Validator
Employee ID Validator
You are given an employee ID as input. You need to validate the ID against the following format:
$$^[A-Z]{3}-(\d{2})-\d{4}$$
The ID must consist of:
- Exactly three uppercase English letters.
- A hyphen ('-').
- Exactly two digits (this represents the department code to be extracted).
- Another hyphen ('-').
- Exactly four digits.
If the input matches the format exactly, output the two-digit department code. Otherwise, output Invalid ID
.
Note: The matching is strict, so any deviation from the required format (such as lowercase letters or missing/extra characters) should be deemed invalid.
inputFormat
The input is provided via standard input (stdin) as a single line containing the employee ID string.
For example:
ABC-12-3456
outputFormat
Output the department code if the employee ID is valid, otherwise output Invalid ID
. The output should be written to standard output (stdout).
For example:
12## sample
ABC-12-3456
12