#include<bits/stdc++.h>
#define N 500009
using namespace std;

int n,pw[9],a[N],b[N]; char ch[N];
bool check(int x){
	int i,k=0,now=0;
	for (i=1; i<=n+k; i++) a[i]=b[i];
	for (i=x; i; i/=10) k++;
	for (i=1; i<k; i++) now+=pw[i-1]*a[i];
	for (i=k; i<=n+k; i++){
		now=now+pw[k-1]*a[i];
		for (; now<0; now+=pw[k]) a[i+1]--;
		if (x%10>=now%10) x=x/10*10+now%10;
		else{
			if (x<10) return 0;
			x=(x/10-1)*10+now%10;
		}
		now=(now-x)/10;
	}
	return 1;
}
int main(){
	scanf("%s",ch+1); n=strlen(ch+1);
	int i;
	for (i=pw[0]=1; i<=7; i++) pw[i]=pw[i-1]*10;
	for (i=1; i<=n; i++) b[i]=ch[n-i+1]-'0';
	int l=1,r=n*9,mid;
	while (l<r){
		mid=l+r>>1;
		if (check(mid)) r=mid; else l=mid+1;
	}
	printf("%d\n",(l-1)/9+1);
	return 0;
}
