Boolean
Boolean-37
Boolean-38
Boolean-39
~/algor $ cat problems/boolean-baxtli-chipta
Lucky ticket
Medium
1000 ms
64 MB
39%
The number of a bus ticket is a six-digit positive integer $n$. A ticket is called “lucky” if the sum of its first three digits equals the sum of its last three digits: for example, $123321$ is lucky because $1 + 2 + 3 = 3 + 2 + 1$. Check whether the statement is true: “the ticket is lucky”.
Input
One six-digit positive integer $n$.
Output
One integer: $1$ if the statement is true, otherwise $0$.
Note
$100000 \le n \le 999999$
Examples
Input #1
123321
Output #1
1
Input #2
123456
Output #2
0