func_code_string: #include <bits/stdc++.h>   using namespace std;   int ans[11][11];   bool ok;   string s;   int sol;   queue<int> dulj, broj;   int pomocnopolje[11][11];   void bfs(int x, int y, int a, int b) {     broj.push(a);     dulj.push(1);     int v[10] = {0};     while (!broj.empty()) {       int duljina = dulj.front();       dulj.pop();       int br = broj.front();       broj.pop();       if (!v[(br + x) % 10]) {         v[(br + x) % 10] = duljina;         broj.push((br + x) % 10);         dulj.push(duljina + 1);       }       if (!v[(br + y) % 10]) {         v[(br + y) % 10] = duljina;         broj.push((br + y) % 10);         dulj.push(duljina + 1);       }     }     pomocnopolje[a][b] = v[b] - 1;     return;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> s;     for (int i = 0; i < 10; i++) {       for (int j = i; j < 10; j++) {         ok = 1;         sol = 0;         for (int k = 0; k < 10; k++) {           for (int l = 0; l < 10; l++) {             bfs(i, j, k, l);           }         }         for (int znj = 1; znj < s.size() and ok; znj++) {           int a = s[znj - 1] -  0 , b = s[znj] -  0 ;           if (pomocnopolje[a][b] >= 0)             sol += pomocnopolje[a][b];           else             ok = 0;         }         if (ok) {           ans[i][j] = sol;           ans[j][i] = sol;         } else {           ans[i][j] = -1;           ans[j][i] = -1;         }       }     }     for (int i = 0; i < 10; i++) {       for (int j = 0; j < 10; j++) {         cout << ans[i][j] <<    ;       }       cout << endl;     }     return 0;   }   