P25342 [AtCoder] Multiple of 11
普及-
题目描述

Problem Description

Numbers divisible by $ 11 $ have a property where the difference between the sum of the digits in odd positions and the sum of the digits in even positions is a multiple of $ 11 $. Note that the units place is considered the $ 1 $st digit, the tens place is the $ 2 $nd digit, and so on, counting from the smallest place value.

For example, for the number $ 7392 $, the digits in even positions are the $ 2 $nd digit $ 9 $ and the $ 4 $th digit $ 7 $, and their sum is $ 16 $. The digits in odd positions are the $ 1 $st digit $ 2 $ and the $ 3 $rd digit $ 3 $, and their sum is $ 5 $. The difference between $ 16 $ and $ 5 $ is $ 11 $, satisfying the mentioned property.

You want to determine if a given integer is a multiple of $ 11 $. To do this, you plan to calculate the sum of the digits in even positions and the sum of the digits in odd positions. Write a program that outputs these two values, separated by a space.

Input Format

The input is given from the standard input in the following format:

$ N $

  • The first line contains the integer $N\ (1\ ≦\ N\ ≦\ 10^{1000}\ -\ 1)$ which you want to check if it is a multiple of $ 11 $.

Output Format

Output the sum of the digits in even positions and the sum of the digits in odd positions in one line, separated by a space. Ensure a newline at the end of the output.

Sample Input and Output

Sample Input #1

7392

Sample Output #1

16 5

Sample Input #2

12345

Sample Output #2

6 9

Sample Input #3

917237645269816381478124891628461341894621418946786785634501961

Sample Output #3

142 163

Notes/Hints

Sample Explanation 1

This is the example explained in the problem statement.

Sample Explanation 2

Inputs that are not multiples of $ 11 $ may also be given.

Sample Explanation 3

Be aware that very large numbers may be given as input.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7392
样例输出
16 5