func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   string s;   int main() {     cin >> s;     int len = s.size();     int index7[20], index2[20], index5[20], index0[20];     int sum7 = 0, sum0 = 0, sum5 = 0, sum2 = 0;     for (int i = 0; i < len; i++) {       if (s[i] ==  5 ) {         index5[sum5] = i;         sum5++;       }       if (s[i] ==  0 ) {         index0[sum0] = i;         sum0++;       }       if (s[i] ==  7 ) {         index7[sum7] = i;         sum7++;       }       if (s[i] ==  2 ) {         index2[sum2] = i;         sum2++;       }     }     int res = 1000;     bool flag = false;     if (sum0 >= 2) {       flag = true;       int temp = (len - 1 - index0[sum0 - 1]) + (len - 2 - index0[sum0 - 2]);       res = min(res, temp);     }     if (sum0 > 0 && sum5 > 0) {       flag = true;       int temp = 0;       if (index0[sum0 - 1] < index5[sum5 - 1]) {         temp = ((index5[sum5 - 1] <= len - 1) ? len - 1 - index5[sum5 - 1] : 0) +                ((index0[sum0 - 1] <= len - 2) ? len - 2 - index0[sum0 - 1] : 0);         temp++;       } else {         temp = ((index5[sum5 - 1] <= len - 2) ? len - 2 - index5[sum5 - 1] : 0) +                ((index0[sum0 - 1] <= len - 1) ? len - 1 - index0[sum0 - 1] : 0);       }       if (index5[sum5 - 1] == 0) {         int i = 1;         while (s[i] ==  0  && i < index0[sum0 - 1]) i++;         temp += i - 1;       }       res = min(res, temp);     }     if (sum5 > 0 && sum2 > 0) {       flag = true;       int temp = 0;       if (index5[sum5 - 1] < index2[sum2 - 1]) {         temp = ((index2[sum2 - 1] <= len - 1) ? len - 1 - index2[sum2 - 1] : 0) +                ((index5[sum5 - 1] <= len - 2) ? len - 2 - index5[sum5 - 1] : 0);         temp++;       } else {         temp = ((index2[sum2 - 1] <= len - 2) ? len - 2 - index2[sum2 - 1] : 0) +                ((index5[sum5 - 1] <= len - 1) ? len - 1 - index5[sum5 - 1] : 0);       }       if (index5[sum5 - 1] == 0 || index2[sum2 - 1] == 0) {         int i = 1;         while (s[i] ==  0 ) i++;         temp += i - 1;       }       res = min(res, temp);     }     if (sum7 > 0 && sum5 > 0) {       flag = true;       int temp = 0;       if (index5[sum5 - 1] < index7[sum7 - 1]) {         temp = ((index7[sum7 - 1] <= len - 1) ? len - 1 - index7[sum7 - 1] : 0) +                ((index5[sum5 - 1] <= len - 2) ? len - 2 - index5[sum5 - 1] : 0);         temp++;       } else {         temp = ((index7[sum7 - 1] <= len - 2) ? len - 2 - index7[sum7 - 1] : 0) +                ((index5[sum5 - 1] <= len - 1) ? len - 1 - index5[sum5 - 1] : 0);       }       if (index5[sum5 - 1] == 0 || index7[sum7 - 1] == 0) {         int i = 1;         while (s[i] ==  0 ) i++;         temp += i - 1;       }       res = min(res, temp);     }     if (!flag)       cout << -1 << endl;     else       cout << res << endl;     return 0;   }   