#include<bits/stdc++.h>
using namespace std;
char s[500010];
int main(){
	//freopen("in","r",stdin);
	//freopen("out","w",stdout);
	scanf("%s",s+1);
	int n=strlen(s+1);
	for(int i=1;i<=n;i++) s[i]-='0';
	s[0]=0;
	int p=1,ans=0,flag=1,last=0;
	while(p<=n){
		//printf("p=%d\n",p);
		if(s[p]<s[p-1]){
			//printf("fake");
			//printf("last=%d p=%d\n",last,p);
			p=last+1;
			//printf("%d",s[p-1]-1);
			//for(int i=p;i<=n;i++) printf("9");
			s[p-1]=0;
			s[n]++;
			for(int i=n;i>=p;i--){
				if(s[i]<10) break;
				s[i]-=10;
				s[i-1]++;
			}
			//cout<<endl;
			ans++;
			flag=1;
			last=p-1;
			//for(int i=p;i<=n;i++) printf("%d",s[i]);cout<<endl;
			//puts("------------------");
		}else{
			//if(!flag) printf("%d",s[p-1]);
			flag=0;
			if(s[p]!=s[p-1]) last=p;
			p++;
		}
	}
	cout<<ans+1<<endl;
	return 0;
}

