#K10471. Roman Numeral Validator

    ID: 23254 Type: Default 1000ms 256MiB

Roman Numeral Validator

Roman Numeral Validator

Your task is to determine whether a given string is a valid Roman numeral. A valid Roman numeral must follow the conventional rules and represent a number in the range \(1\) to \(3999\). The numeral should adhere to the standard notation rules. For instance, the numeral IV is valid for 4 while IIII is not acceptable.

You are required to read a single line from standard input, which contains the Roman numeral string, and output either True if the numeral is valid, or False otherwise.

inputFormat

The input consists of a single line containing a non-empty string representing the Roman numeral to be validated.

Example:

XII

outputFormat

Output a single line: True if the input string is a valid Roman numeral (in the range 1 to 3999), otherwise output False.

Example:

True
## sample
XII
True