#C10869. ISBN-10 Validator

    ID: 40121 Type: Default 1000ms 256MiB

ISBN-10 Validator

ISBN-10 Validator

Given a string, determine if it is a valid ISBN-10 code. An ISBN-10 is valid if and only if its digits (with the possibility of an 'X' representing 10 in the last position) fulfill the following condition:

$$\sum_{i=1}^{10} d_i \times i \equiv 0\pmod{11},$$

where for the last character, if it is 'X', then \(d_{10}=10\). The program should read the input ISBN from stdin and output either "True" if the ISBN is valid or "False" otherwise to stdout.

inputFormat

A single line containing the ISBN-10 string. The string may contain digits and possibly the character 'X' as the last character.

outputFormat

Print "True" if the provided ISBN-10 string is valid according to the ISBN-10 rules; otherwise, print "False".## sample

0471958697
True

</p>