#K14486. ISBN-10 Validator
ISBN-10 Validator
ISBN-10 Validator
This problem requires you to validate an ISBN-10 string. The ISBN-10 identifier consists of 10 characters and is considered valid if it satisfies the formula:
$$\sum_{i=1}^{10} i \times v_i \equiv 0 \pmod{11}$$
Here, each digit (or the character X
representing 10 when it appears as the last character) is multiplied by its position (1-indexed). The sum of these products must be divisible by 11. If the input string does not have exactly 10 characters or contains inappropriate characters, it should be deemed invalid.
inputFormat
The input is provided from standard input. It consists of a single line containing the ISBN-10 string. The string should be exactly 10 characters long.
outputFormat
Output a single line to the standard output: print Valid ISBN
if the string is a valid ISBN-10, and Invalid ISBN
otherwise.
0306406152
Valid ISBN