#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>
#include <cassert>
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
#define sz(a) ((int) a.size())
using ll = long long;
const int mod = 1e9 + 7;
ll fast_power(ll base, ll power)
{
ll ans = 1;
while (power > 0){
if (power & 1) ans = (ans*base) % mod;
base = (base*base) % mod;
power >>= 1;
}
return ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed;
cout.precision(6);
string s;
cin >> s;
sort(s.begin(), s.end());
int cnt = 0;
for (int i = 0; i < s.size(); i++) {
cnt += abs(s[i] - s[s.size() / 2]);
}
cout << cnt;
return 0;
}
Copy