// Slower C++ solution:
#include <algorithm>

#include <bitset>

#include <complex>

#include <deque>

#include <exception>

#include <fstream>

#include <functional>

#include <iomanip>

#include <ios>

#include <iosfwd>

#include <iostream>

#include <istream>

#include <iterator>

#include <limits>

#include <list>

#include <locale>

#include <map>

#include <memory>

#include <new>

#include <numeric>

#include <ostream>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <stdexcept>

#include <streambuf>

#include <string>

#include <typeinfo>

#include <utility>

#include <valarray>

#include <vector>

#if __cplusplus >= 201103L

#include <array>

#include <atomic>

#include <chrono>

#include <condition_variable>

#include <forward_list>

#include <future>

#include <initializer_list>

#include <mutex>

#include <random>

#include <ratio>

#include <regex>

#include <scoped_allocator>

#include <system_error>

#include <thread>

#include <tuple>

#include <typeindex>

#include <type_traits>

#include <unordered_map>

#include <unordered_set>

#endif



long long max(long long x, long long y){return (x > y ? x : y);}

long long min(long long x, long long y){return (x < y ? x : y);}

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }



#define ll int

#define FOR(i,a) for(ll i=0;i<(ll)a.size();i++)

#define pb push_back

#define ld long double

#define mp make_pair

#define F first

#define S second

#define pii pair<ll,ll> 



using namespace :: std;



const ll maxn=6e5+500;

const ll inf=1e9+800;

const ll mod=1e9+7;



vector<char> de;

deque<ll>  fargh;



void makee(){

	fargh.clear();

	for(ll i=1;i<de.size();i++){

		if(de[i]!=de[i-1]){

			fargh.pb(de[i-1]);

		}

	}

}

void pel(){

	ll tol=0;

	for(ll i=0;i<de.size();i++){

		tol=i;

		if(i+1!=de.size() && de[i]!=de[i+1]){

			fargh.pop_front();

		}

		if(de[i]=='9'){

			de[i]='0';

		}else{

			de[i]++;

			break;

		}

	}	

	for(ll i=tol;i>=0;i--){

		if(i+1!=de.size()){

			if(de[i]!=de[i+1]){

				fargh.push_front(de[i]);

			}

		}

	}

}

bool good(){

	if(de.size()==0)return 0;

	if(fargh.size()==0)return 1;

	if(fargh.back()<de.back())return 0;

	else  return 1;

}

void pri(){

	for(ll i=(ll)de.size()-1;i>=0;i--){

		cout<<de[i];

	}

	cout<<"***"<<endl;

}

int main(){

	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);	



	string s;

	cin>>s;

	reverse(s.begin(),s.end());

	for(ll i=0;i<s.size();i++){

		de.pb(s[i]);

	}

	makee();

	ll ans=0;

	while(de.size()){

	//	pri();

		ans++;

		while(good()){

			char c=de.back();

			de.pop_back();

			if(de.size()!=0){

				if(de.back()!=c){

					fargh.pop_back();

				}

			}

		}

		if(de.size()){

			char c=de.back();

			de.pop_back();

			if(de.size()){

				if(de.back()!=c){

					fargh.pop_back();

				}

			}

			pel();

		}

	}

	cout<<ans;

}




// Faster C++ solution for the same problem (measured speedup: 5.357308735680431x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 5000000

using namespace std;

typedef int hp[MAXN+5];

char str[MAXN+5];

int sum=0;

hp N,d;

void Str_To_Hp(char *s,hp &x)

{

	int len=strlen(s);

	for(int i=0;i<len;i++)

		x[len-i]=s[i]-'0';

	x[0]=len;

}

void Clear(hp &x)

{

	for(int i=x[0];i>=0;i--)

		x[i]=0;

}

void Add(hp &a,int b)

{

	int len=a[0];

	sum-=a[1];

	a[1]+=b;

	for(int i=1;true;i++)

	{

		sum+=a[i]%10;

		if(a[i]>=10)

		{

			sum-=a[i+1];

			a[i+1]+=a[i]/10;

			a[i]%=10;

		}

		else

		{

			len=max(i,len);

			break;

		}

	}

	len++;

	while(len>1&&a[len]==0)

		len--;

	a[0]=len;

}

void Mul(hp a,int b,hp &c)

{

	Clear(d);

	int len=a[0];

	for(int i=1;i<=len;i++)

	{

		d[i]+=a[i]*b;

		d[i+1]+=d[i]/10;

		d[i]%=10;

	}

	len++;

	while(d[len])

	{

		d[len+1]+=d[len]/10;

		d[len]%=10;

		len++;

	}

	while(len>1&&d[len]==0)

		len--;

	d[0]=len;

	for(int i=0;i<=len;i++)

		c[i]=d[i];

}

bool Check(int k)

{

	int sum=0;

	for(int i=1;i<=N[0];i++)

		sum+=N[i];

	if(sum>9*k)

		return false;

	return true;

}

int main()

{

	scanf("%s",str);

	Str_To_Hp(str,N);

	Mul(N,9,N);

	sum=0;

	for(int i=1;i<=N[0];i++)

		sum+=N[i];

	for(int k=1;true;k++)

	{

		Add(N,9);

		if(sum<=9*k)

		{

			printf("%d\n",k);

			return 0;

		}

	}

	return 0;

}