#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  int sz = s.length();
  int i = 0;
  vector<string> opx;
  string second;
  while (i != sz) {
    second = "";
    if (s[i] != '0') {
      second += s[i];
      for (int j = i + 1; j < sz; j++) second += "0";
      opx.emplace_back(second);
    }
    i++;
  }
  cout << opx.size() << "\n";
  for (auto x : opx) cout << x << " ";
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
