#AGC011E. [AGC011E] Increasing Numbers

[AGC011E] Increasing Numbers

Score : 13001300 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, 15581558, 1111, 33 and 00 are all increasing; 1010 and 2017031220170312 are not.

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

Constraints

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

Input

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

NN

Output

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

80
2

One possible representation is 80=77+380 = 77 + 3.

123456789
1

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

20170312
4
7204647845201772120166980358816078279571541735614841625060678056933503
31