#include <iostream>
using namespace std;
int main()
{
int T;
cin >> T;
while (T -- )
{
string s;
int res = 0;
cin >> s;
for (auto c: s)
if (c != '0')
res ++ ;
cout << res << endl;
for (int i = s.size() - 1, t = 1; i >= 0; t *= 10, i -- )
if (s[i] != '0')
cout << (s[i] - '0') * t << ' ';
puts("");
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t -- )
{
int x;
cin >> x;
int res = 0;
if (x < 10 || x == 10000) cout << 1 << endl << x << endl;
else
{
int a = x % 10;
x /= 10;
int b = x % 10;
x /= 10;
int c = x % 10;
x /= 10;
int d = x % 10;
if (a != 0) res ++ ;
if (b != 0) res ++ ;
if (c != 0) res ++ ;
if (d != 0) res ++ ;
cout << res << endl;
if (a != 0) cout << a << ' ';
if (b != 0) cout << b * 10 << ' ';
if (c != 0) cout << c * 100 << ' ';
if (d != 0) cout << d * 1000 << ' ';
cout << endl;
}
}
return 0;
}
作者:我是java同学
链接:https://www.acwing.com/solution/content/170716/
来源:AcWing
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。