#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main()
{
int n;
cin >> n;
int t = n, x = n;
int cnt = 0;
if (n == 0) {//为0时
cout << "1" << endl;
cout << "0" << endl;
cout << "0" << endl;
}
else {//不为0时
while (n != 0) {//求位数
n = n / 10;
cnt++;
}
cout << cnt << endl;
//顺序输出
int cnt1 = cnt;
while (cnt1>1) {
int j = pow(10, (cnt1 - 1));
int a = t / j;
t = t % j;
cout << a << " ";
cnt1--;
}
cout << t << endl;
//逆序输出
int cnt2 = cnt;
while (cnt2 > 0) {
int b = x % 10;
cout << b;
x = x / 10;
cnt2--;
}
}
return 0;
}