#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string strNumber;
    cin >> strNumber;
    string rounds[strNumber.length()];
    int count = 0;
    for (int j = 0; j < strNumber.length(); j++) {
      if (strNumber[j] == '0') {
        rounds[j] = '0';
        continue;
      }
      rounds[j] = strNumber[j];
      rounds[j].resize(strNumber.length() - j, '0');
      count++;
    }
    cout << count << "\n";
    for (int j = 0; j < strNumber.length(); j++) {
      if (rounds[j][0] != '0') {
        cout << rounds[j] << ' ';
      }
    }
    cout << "\n";
  }
  return 0;
}
