/// Fuck Them, Fuck Me, and Fuck You
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define pb push_back
#define F first
#define S second
#define f(i,a,b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 3e5 + 5, LG = 19, MOD = 1e9 + 7;
ll ans[1000006];
ll ans2[1000006];
int main(){
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
string s;
cin >> s;
vector<int> ans(26);
for(char c : s){
for(int i = 0; i < 26; i++){
ans[i] += abs(i-(c-'a'));
}
}
cout << *min_element(all(ans)) << '\n';
return 0;
}
Copy