#include using namespace std; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); string S; cin >> S; sort(S.begin(), S.end()); cout << S[2]-S[0] << "\n"; return 0; }