#include using namespace std; #define rep(i, n) for(int i = 0, n_f = (int)(n); i < n_f; ++i) #define rrep(i, n) for(int i = 1, n_f = (int)(n); i <= n_f; ++i) #define rrrep(i, a, n, p) for(int i = (int)(a), n_f = (int)(n), p_f = (int)(p); i <= n_f; i+=p_f) #define repd(i, n) for(int i = (int)(n), n_f = 0; i >= n_f; --i) #define all(a) (a).begin(),(a).end() #define pb(a) push_back(a) #define eb(a) emplace_back(a) #define mpa(a,b) make_pair(a,b) #define YES(a) if(a){cout<<"YES"< vint; typedef vector> vvint; typedef vector vstr; typedef vector vbol; typedef vector> vvbol; typedef vector vll; typedef vector> vvll; typedef vector> vpint; const int dx[] = {-1,0,1,0}; const int dy[] = {0,1,0,-1}; const int mod99 = 998244353; const int mod107 = 1000000007; const ll mod99ll = 998244353LL; const ll mod107ll = 1000000007LL; const int INF = 1000000000; const ll INFll = 1000000000000000000LL; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (bT permu(const T &n,const T &m) {T ret=1;for(T i=n;i>m;--i)ret*=i;return ret;} templateT conbi(const T &n,const T &m) {return permu(n,m)/permu(m,2);} templateT homog(const T &n,const T &m) {return conbi(n+m-1,m);} templateT mod_pow(T &a,T &n,const T &mod) {T ret=(T)1;while(n>0){if(n&(T)1)ret=ret*a%mod;a=a*a%mod;n>>=(T)1;}return ret;} templateT mod_inv(const T &a,const T &mod) {return modpow(a,mod-(T)2,mod);} template T gcd(T n,T m){if(max(n,m)%min(n,m)==(T)0) return min(n,m);return gcd(min(n,m),(max(n,m)%min(n,m)));} vector> run_length(string s){vector> r;for(int i=0;i vector prime_sieve(T n){vector ret((n+1)/2,true);vector prime_list = {2};ret[0] = false;T m = ((n+1)/2-2)/3;for(T a=1;a<=m;++a){for(T b=1;b<=a&&a+b+2*a*b<=(n+1)/2-1;++b){ret[a+b+2*a*b] = false;}}for(T i=0;i vector prime_fac(T n){vector lpf(n+1,n+1),prime_list,ret;lpf[0]=0;lpf[1]=1;for(T i=2;i<=n;++i){if(lpf[i]==n+1){prime_list.emplace_back(i);lpf[i] = i;}for(T j=0;jlpf[i]||p*i>n) break;lpf[p*i] = p;}}while(n!=1){ret.emplace_back(lpf[n]);n/=lpf[n];}return ret;} int main(void){ string s; cin>>s; cout<<(int)(max({s[0],s[1],s[2]})-max({s[0],s[1],s[2]}))<