#include <cstdio>
#include <algorithm>
using namespace std;

int L;
char S[500500];

bool chk(int m)
{
	int r = 0, s = m * 9;
	for (int i=L-1;i>=0;i--){
		while (r+s > 0 && (r+s) % 10 != S[i] - '0') s--;
		if ((r+s) % 10 != S[i] - '0') return false;
		r += s;
		r /= 10;
	}
	return true;
}

int main()
{
	scanf ("%s",S);
	while (S[L]) L++;

	int l = 0, r = L;
	while (l + 1 < r){
		int m = (l + r) / 2;
		if (chk(m)) r = m;
		else l = m;
	}
	printf ("%d\n",r);

	return 0;
}
