Did you win the Digits Game? It's time for round 2. This time, you must take a single integer and add up all of its individual digits, but you must keep doing this until the sum is a single digit number between 1-9.
Input Specification
The first and only line of input will contain a single integer not greater than digits in length.
Output Specification
Sum the individual digits of the integer and continue to do so to the sum until you are left with a number between 1 and 9.
Sample Input
25938
Sample Output
9
Explanation for Sample Input
The first sum is . From there we calculate . Because is a single digit number, that is our final result.
Comments
The link uses tssoj.me instead of tssoj.ca >:(
When we migrated links to
tssoj.ca
, this does not mean the links in problem statements were changed as well. The problem authors are responsible for maintaining their own problems.