#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int N = 5e5 + 20;
int n, a[N], b[N], mx[N];
string s;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s;
  n = (int)s.size();
  for (int i = 0; i < n; i++) a[i] = s[i] - '0';
  int low = 0, high = N;
  while (high - low > 1) {
    for (int i = 0; i < n; i++) b[i] = a[i];
    int mid = (low + high) / 2;
    bool ok = 1;
    for (int i = n - 1; i >= 0; i--) {
      if (i == n - 1)
        mx[i] = 9 * mid;
      else
        mx[i] = mx[i + 1];
      int k = (mx[i] % 10 + 10) % 10;
      k = mx[i] - k;
      k += (a[i] % 10 + 10) % 10;
      if (k > mx[i]) k -= 10;
      mx[i] = k;
      assert((mx[i] - a[i]) % 10 == 0);
      if (mx[i] < a[i]) {
        ok = 0;
        break;
      }
      a[i - 1] -= (mx[i] - a[i]) / 10;
      a[i] = mx[i];
    }
    if (ok)
      high = mid;
    else
      low = mid;
    for (int i = 0; i < n; i++) a[i] = b[i];
  }
  cout << high << '\n';
}
