#include<iostream>
using namespace std;
int main()
{
int a,m,n,p,q,r,s,t,u;
cin>>a;
if(a<10)
{
cout<<"1"<<endl;
cout<<a<<endl;
cout<<a<<endl;
}
if(a<100&&a>=10)
{
cout<<"2"<<endl;
m=a%10;
n=a/10;
cout<<n<<" "<<m<<endl;
cout<<m<<n<<endl;
}
if(a<1000&&a>=100)
{
cout<<"3"<<endl;
m=a%10;
n=a%100;
p=n/10;
q=a/100;
cout<<q<<" "<<p<<" "<<m<<endl;
cout<<m<<p<<q<<endl;
}
if(a<10000&&a>=1000)
{
cout<<"4"<<endl;
m=a%10;
n=a%100;
p=n/10;
q=a%1000;
r=q/100;
s=a/1000;
cout<<s<<" "<<r<<" "<<p<<" "<<m<<endl;
cout<<m<<p<<r<<s<<endl;
}
if(a>=10000)
{
cout<<"5"<<endl;
m=a%10;
n=a%100;
p=n/10;
q=a%1000;
r=q/100;
s=a/1000;
t=s%10;
u=s/10;
cout<<u<<" "<<t<<" "<<r<<" "<<p<<" "<<m<<endl;
cout<<m<<p<<r<<t<<u<<endl;
}
return 0;
}
using namespace std;
int main()
{
int a,m,n,p,q,r,s,t,u;
cin>>a;
if(a<10)
{
cout<<"1"<<endl;
cout<<a<<endl;
cout<<a<<endl;
}
if(a<100&&a>=10)
{
cout<<"2"<<endl;
m=a%10;
n=a/10;
cout<<n<<" "<<m<<endl;
cout<<m<<n<<endl;
}
if(a<1000&&a>=100)
{
cout<<"3"<<endl;
m=a%10;
n=a%100;
p=n/10;
q=a/100;
cout<<q<<" "<<p<<" "<<m<<endl;
cout<<m<<p<<q<<endl;
}
if(a<10000&&a>=1000)
{
cout<<"4"<<endl;
m=a%10;
n=a%100;
p=n/10;
q=a%1000;
r=q/100;
s=a/1000;
cout<<s<<" "<<r<<" "<<p<<" "<<m<<endl;
cout<<m<<p<<r<<s<<endl;
}
if(a>=10000)
{
cout<<"5"<<endl;
m=a%10;
n=a%100;
p=n/10;
q=a%1000;
r=q/100;
s=a/1000;
t=s%10;
u=s/10;
cout<<u<<" "<<t<<" "<<r<<" "<<p<<" "<<m<<endl;
cout<<m<<p<<r<<t<<u<<endl;
}
return 0;
}