#include using namespace std; int main() { string abc; cin >> abc; sort(abc.begin(), abc.end()); int ans = abc.at(2) - abc.at(0); cout << ans << endl; }