Digit Sum Mod 9

Digit Sum Mod 9

Medium Computer Mathematics Integers & Divisibility 37 views
Explanation Complexity

Problem Statement

Given a big number as string, print its digit sum modulo 9.

Input Format

One line: digits string s.

Output Format

One integer 0-8.

Constraints

1

Input / Output Format

Input Format
One line: digits string s.
Output Format
One integer 0-8.
Constraints
1

Examples

Input:
999999999999
Output:
0

Example Solution (Public)

Computer Mathematics
Sum digits, take modulo 9 while adding to avoid big numbers.

Official Solution Code

Sum digits, take modulo 9 while adding to avoid big numbers.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.