#include<stdio.h>
void main()
{ int m,i,a,b,c,d,e;
scanf("%d",&i);
if(i>=0&&i<10)
{
m=1;
}
else if(i>=10&&i<100)
{
m=2;
}
else if(i>=100&&i<1000)
{
m=3;
}
else if(i>=1000&&i<=9999)
{
m=4;
}
else if(i>=10000&&i<=99999)
{
m=5;
}
else
{
printf("error");
}
switch(m)
{
case 1:
printf("1位数\n");
printf("逆序输出%d\n%d\n",i,i);
break;
case 2:
b=i%10;
a=i/10;
printf("2位数\n");
printf("%d\n%d\n",b,a);
printf("逆序输出%d\n",a*10+b);
break;
case 3:
c=i/100;
b=i%100/10;
a=i%100%10;
printf("3位数\n");
printf("%d\n%d\n%d\n",c,b,a);
printf("逆序输出%d\n",a*100+b*10+c);
break;
case 4:
d=i/1000;
c=i%1000/100;
b=i%100/10;
a=i%10;
printf("4位数\n");
printf("%d\n%d\n%d\n%d\n",d,c,b,a);
printf("逆序输出%d\n",a*1000+b*100+c*10+d);
break;
case 5:
e=i/10000;
d=i%10000/1000;
c=i%1000/100;
b=i%100/10;
a=i%10;
printf("5位数\n");
printf("%d\n%d\n%d\n%d\n%d\n",e,d,c,b,a);
printf("逆序输出%d\n",a*10000+b*1000+c*100+d*10+e);
break;
}
}