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