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

char str[500003]; int N;

bool check(int mid){
	int minus = 0;
	for(int i = 1 ; i <= N ; ++i){
		int t = str[i] - '0' - minus; if(t > mid) return 0;
		minus = (mid - t) / 10; mid = t + 10 * minus;
	}
	return 1;
}

int main(){
	scanf("%s" , str + 1); N = strlen(str + 1); reverse(str + 1 , str + N + 1); int L = 1 , R = 10 * N;
	while(L < R){int mid = (L + R) >> 1; check(mid) ? R = mid : L = mid + 1;}
	cout << (L + 8) / 9; return 0;
}
