Contest Duration: - (local time) (110 minutes) Back to Home
E - Increasing Numbers /

Time Limit: 2 sec / Memory Limit: 256 MB

### 問題文

10 進法で表記したとき，桁同士が隣り合っているところではすべて，右にある桁の値のほうが左にある桁の値以上であるような 0 以上の整数を，増加的と呼ぶことにします． たとえば，15581130 は増加的ですが，1020170312 は増加的ではありません．

すぬけ君は，整数 N を持っています． N が最小で何個の増加的な数の和として表されるかを求めてください．

### 制約

• 1 \leq N \leq 10^{500000}

N

### 出力

N が最小で何個の増加的な数の和として表されるかを出力せよ．

80

2

123456789

### 出力例 2

1

123456789 はそれ自体が増加的なので，1 個の増加的な数の和で表すことができます．

20170312

4

### 入力例 4

7204647845201772120166980358816078279571541735614841625060678056933503

### 出力例 4

31

Score : 1300 points

### Problem Statement

We will call a non-negative integer increasing if, for any two adjacent digits in its decimal representation, the digit to the right is greater than or equal to the digit to the left. For example, 1558, 11, 3 and 0 are all increasing; 10 and 20170312 are not.

Snuke has an integer N. Find the minimum number of increasing integers that can represent N as their sum.

### Constraints

• 1 \leq N \leq 10^{500000}

### Input

The input is given from Standard Input in the following format:

N

### Output

Print the minimum number of increasing integers that can represent N as their sum.

80

### Sample Output 1

2

One possible representation is 80 = 77 + 3.

123456789

### Sample Output 2

1

123456789 in itself is increasing, and thus it can be represented as the sum of one increasing integer.

20170312

4

### Sample Input 4

7204647845201772120166980358816078279571541735614841625060678056933503

31