题库练习 Sum of Digits
← 上一题 下一题 →

A8223 | Sum of Digits

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number $n$ . How many times can Gerald put a spell on it until the number becomes one-digit?

输入格式

The first line contains the only integer $n$ ( $0<=n<=10^{100000}$ ). It is guaranteed that $n$ doesn't contain any leading zeroes.

输出格式

Print the number of times a number can be replaced by the sum of its digits until it only contains one digit.

输入输出样例

输入 #1
0
输出 #1
0
输入 #2
10
输出 #2
1
输入 #3
991
输出 #3
3
C++ 编辑器
输入
输出