#include <bits/stdc++.h>
using namespace std;
int main() {
  int test_case, len_of_a, ans;
  string str;
  cin >> test_case;
  for (int i = 0; i < test_case; i++) {
    cin >> str;
    len_of_a = str.length();
    ans = 0;
    for (int j = len_of_a - 1; j >= 0; j--) {
      if (str[j] != '0') ans++;
    }
    cout << ans << endl;
    for (int j = len_of_a - 1; j >= 0; j--) {
      if (str[j] != '0') {
        cout << str[j];
        int temp = j;
        while (temp < len_of_a - 1) {
          cout << '0';
          temp++;
        }
        cout << ' ';
      }
    }
    cout << endl;
  }
}
