50116. Play with digits

I'm a slow walker, but I never walk backwards.

Task Description

We have a huge decimal number N. Write a program to determine the followings:

  • The number of digits in N.
  • Is N an even number?
  • The number of zeros in it.
  • Is N a multiple of 11? Note that we can determine if N is a multiple of 11 by checking the difference between the sum of the odd positioned digits and the sum of the even positioned digits. For example, 82375 is not a multiple of 11 because the sum of the even positioned digits is 2 + 7 = 9, and the sum of the odd positioned digits is 8 + 3 + 5 = 16, and the difference between 9 and 16 is 7, which is not a multiple of 11.

We will give you the number one digit per line. For example, if you get digits ‘1’, ‘2’, ‘3’, ’4’, ‘0’ in order, then the number is 12340. The number will not start with 0.

Input Format

The input has several lines. Each line has a digit. EOF indicates the end of input.

Output Format

Output the four answers above line by line. If the number is even output a 1; otherwise a 0. If the number is a multiple of 11 output a 1; otherwise output a 0.

Subtask

  • 10 points: you can store the decimal number in an integer without overflow
  • 10 points: the number of digits is no more than 32768, so you can store digits in an array
  • 80 points: you will get MLE if you use array

Sample Input 1

1
2
3
4
0

Sample Output 1

5
1
1
0

Discussion