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