Problem7548--[CSES Problem Set] Removing Digits

7548: [CSES Problem Set] Removing Digits

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

You are given an integer $n$. On each step, you may subtract one of the digits from the number.
How many steps are required to make the number equal to $0$?

Input

The only input line has an integer $n$.

Output

Print one integer: the minimum number of steps.

Constraints

$1≤n≤10^6$

Sample 1 Input

27

Sample 1 Output

5
An optimal solution is $27 \rightarrow 20 \rightarrow 18 \rightarrow 10 \rightarrow 9 \rightarrow 0$.

HINT

相同题目:CSES 1637

Source/Category