#K91347. Divisibility by 11 Checker
Divisibility by 11 Checker
Divisibility by 11 Checker
Given a non-negative integer in the form of a string N, determine whether N is divisible by 11 without converting the string into an integer.
You must compute the alternating sum of digits by summing the digits at odd indices and even indices respectively (considering 0-indexed positions), and then check if the absolute difference between these two sums is divisible by 11.
The solution should read input from standard input and write the result to standard output. Output exactly True
if the number is divisible by 11 and False
otherwise.
Note: Use the following rule in LaTeX format: A number N is divisible by 11 if and only if \(|\sum_{i \in odd} d_i - \sum_{i \in even} d_i| \equiv 0 \pmod{11}\).
inputFormat
The input consists of a single line containing a string N representing a non-negative integer. The string may be very large, so direct conversion to integer is not allowed.
outputFormat
Output True
if the number is divisible by 11; otherwise, output False
.
121
True
</p>