#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int u = s.length(), c = 0;
    for (int i = 0; i < u; i++)
      if (s[i] != '0') ++c;
    cout << c << "\n";
    for (int i = 0; i < u; i++) {
      if (s[i] != '0') {
        cout << s[i];
        for (int j = i; j < u - 1; j++) cout << 0;
        cout << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
