#K46302. ISBN-10 Validation
ISBN-10 Validation
ISBN-10 Validation
This problem requires you to determine if a given string is a valid ISBN-10 code. The ISBN-10 code is validated by removing all hyphens, and then checking if the weighted sum of its digits satisfies a specific divisibility condition.
The weighted sum \(S\) is calculated as:
\( S = 1 \times d_1 + 2 \times d_2 + \cdots + 10 \times d_{10} \)
Here, each \(d_i\) is the numeric value of the i-th digit. Note that the last digit can be the character 'X' which represents a value of 10. The code is valid only if \(S\) is divisible by 11.
You must read the input from standard input and print the result to standard output. The expected output is "Valid" if the ISBN-10 code is correct, and "Invalid" otherwise.
inputFormat
The input consists of a single line containing the ISBN-10 string. The string may include hyphens which should be removed before processing.
outputFormat
Output a single line, either "Valid" if the ISBN-10 passes the checksum validation, or "Invalid" otherwise.
## sample0-306-40615-2
Valid