#C4330. Balanced Number Check
Balanced Number Check
Balanced Number Check
We call a number balanced if the sum of its digits in the left half is equal to the sum of its digits in the right half. In the case of an odd number of digits, the middle digit is ignored.
For example, the number 123321 is balanced since (1 + 2 + 3) equals (3 + 2 + 1), while 123322 is not balanced. Your task is to determine whether a given number is balanced.
Note: A single digit is always considered balanced.
inputFormat
The input consists of a single line containing a positive integer n
which is the number to be checked. The input is provided via stdin
.
outputFormat
Output a single line to stdout
containing True
if the number is balanced, and False
otherwise.
123321
True