func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int MOD = 998244353;   long long int INF = 1e18;   long long int vv;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int i, j, k = 0, l = 0, r = 0, m = 0, n, c, p = 0, cnt = 0,                         cnt1 = 0, x, y, z = 0, a, b, low, mid, high, ans = 0,                         maxi = 0, mini = INF, t, x1, y1;     string s;     cin >> s;     n = s.size();     queue<long long int> q;     long long int V[n];     bool visited[10];     long long int dist[10];     long long int ds[10][10];     for (i = 0; i < n; i++) {       k = s[i];       k = k - 48;       V[i] = k;     }     for (i = 0; i <= 9; i++) {       for (j = 0; j <= 9; j++) {         for (l = 0; l <= 9; l++) {           for (r = 0; r <= 9; r++) {             ds[l][r] = -1;           }         }         for (l = 0; l <= 9; l++) {           for (r = 0; r <= 9; r++) {             visited[r] = false;             dist[r] = INF;           }           q.push(l);           dist[l] = 0;           if (i == 0 || j == 0) {             ds[l][l] = 1;             visited[l] = true;           }           while (!q.empty()) {             k = q.front();             q.pop();             r = (k + i) % 10;             if (visited[r] == false) {               visited[r] = true;               dist[r] = (dist[k] + 1);               ds[l][r] = dist[r];               q.push(r);             }             r = (k + j) % 10;             if (visited[r] == false) {               visited[r] = true;               dist[r] = (dist[k] + 1);               ds[l][r] = dist[r];               q.push(r);             }           }         }         cnt = 0;         for (l = 0; l < n - 1; l++) {           if (ds[V[l]][V[l + 1]] == -1) {             cnt = -1;             goto last;           } else {             cnt += ds[V[l]][V[l + 1]] - 1;           }         }       last:         cout << cnt <<    ;       }       cout << endl;     }   }   