#K95972. Valid Hexadecimal Checker

    ID: 38982 Type: Default 1000ms 256MiB

Valid Hexadecimal Checker

Valid Hexadecimal Checker

Problem Description:

Given a string read from standard input, determine whether it represents a valid hexadecimal number in the form (0x\textit{hex}), where (\textit{hex}) is either empty or a sequence of hexadecimal digits (0–9, A–F, a–f). Note that the string must start with the prefix (0x); otherwise, it is considered invalid. For example, (0x1A3F) and (0x) are valid, while (1A3F) or strings containing non-hexadecimal characters are invalid.

Input is taken from standard input and results are printed to standard output as either "True" or "False".

inputFormat

The input consists of a single line containing the string (s).

outputFormat

Output (True) if the input string (s) is a valid hexadecimal number as defined above, otherwise output (False).## sample

0x1A3F
True