#C2497. Count Balanced Numbers
Count Balanced Numbers
Count Balanced Numbers
You are given a list of positive integers. A number is defined as balanced if the sum of its digits at odd indices is equal to the sum of its digits at even indices. Here, indices start at 0 (i.e. the leftmost digit is at index 0, the next at index 1, and so on). For instance, consider the number \(1234\): the digits at indices 0 and 2 are 1 and 3 (sum \(= 4\)), and the digits at indices 1 and 3 are 2 and 4 (sum \(= 6\)); hence, \(1234\) is not balanced.
Your task is to count how many balanced numbers are present in the list.
Note: Single-digit numbers are not considered balanced since the sum of digits at even indices (index 0) does not equal the sum at odd indices (which is 0).
inputFormat
The input is given via stdin and has the following format:
N number1 number2 ... numberN
Here, \(N\) is a positive integer representing the number of test numbers, and each subsequent line contains one number.
outputFormat
Output a single integer via stdout — the count of balanced numbers in the list.
## sample4
1234
4321
1111
2222
2