#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0, k, m;
  cin >> n;
  string s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n; i++) {
    m = k = s[i].size();
    for (int j = 0; j < k; j++) {
      if (s[i][j] == '0') {
        c++;
      }
    }
    c = m - c;
    cout << c << endl;
    for (int j = 0; j < k; j++) {
      if (s[i][j] != '0') {
        cout << s[i][j];
        while ((m - j - 1) > 0) {
          cout << "0";
          m--;
        }
        m = k;
        cout << " ";
      }
    }
    cout << endl;
    c = 0;
  }
  return 0;
}
