#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long n, i, j, x, count, temp, flag, rav, nik, z;
  long long ans[10][10], visited[10] = {0}, dp[10][10];
  n = s.length();
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++) {
      count = 0;
      if (j < i) {
        cout << ans[j][i] << " ";
      } else {
        queue<long long> q;
        for (rav = 0; rav < 10; rav++) {
          for (nik = 0; nik < 10; nik++) {
            dp[rav][nik] = -1;
          }
        }
        for (x = 1; x < n; x++) {
          z = count;
          flag = 0;
          if (dp[s[x - 1] - 48][s[x] - 48] != -1) {
            count += dp[s[x - 1] - 48][s[x] - 48];
            continue;
          }
          q.push(s[x - 1] - 48);
          while (!q.empty()) {
            temp = q.front();
            q.pop();
            if (temp == -1) {
              count++;
              if (q.empty()) break;
              q.push(-1);
              continue;
            }
            if (flag != 0 && temp == s[x] - 48) {
              break;
            }
            if (visited[(temp + i) % 10] == 0) {
              visited[(temp + i) % 10] = 1;
              q.push((temp + i) % 10);
            }
            if (visited[(temp + j) % 10] == 0) {
              visited[(temp + j) % 10] = 1;
              q.push((temp + j) % 10);
            }
            if (flag == 0) {
              q.push(-1);
              flag = 1;
            }
          }
          for (temp = 0; temp < 10; temp++) {
            visited[temp] = 0;
          }
          if (q.empty()) {
            count = -1;
            break;
          }
          while (!q.empty()) {
            q.pop();
          }
          dp[s[x - 1] - 48][s[x] - 48] = count - z;
        }
        ans[i][j] = count;
        cout << count << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
