#include <bits/stdc++.h>
#define int long long
#define P(x) cout << x << endl
#define D(x) P(#x << ": " << x)
#define F(i,n) for (int i=0; i<(int)(n); i++)
#define DEC(i,n) for (int i=(int)(n); --i>=0;)
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;

signed main() {
    string s; cin>>s;
    int n=s.size();
    int lo=0, hi=2*n; // lo impossible, hi possible
    while (hi-lo >= 2) {
        int mid = (lo+hi)/2;
        int cur = mid*9, carry=0;
        //P("trying "<<mid);
        bool ok=true;
        DEC(i,n) {
            while ((cur+carry)>=0 && (cur+carry)%10 != s[i]-'0')
                cur--;
            //D(cur);
            if (cur+carry < 0) {
                ok = false;
                break;
            }
            carry = (cur+carry)/10;
        }
        if (ok) {
            hi = mid;
            //P("okay");
        } else {
            lo = mid;
            //P("not okay");
        }
    }
    P(hi);
}