semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
	int n,i,j,a[100][100],i1,i2,j1,j2,p;
	scanf ("%d",&n);
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			scanf("%d",&a[i][j]);
	p=1;
	for(i=0;i<n&&p;i++)
		for(j=0;j<n&&p;j++)
			if(a[i][j]==0){i1=i;j1=j;p=0;}
	p=1;
	for(i=n-1;i>=0&&p;i--)
		for(j=n-1;j>=0&&p;j--)
			if(a[i][j]==0){i2=i;j2=j;p=0;}
	printf("%d\n",(i2-i1-1)*(j2-j1-1));
	return 0;
}
int main(){
	int n[1000][1000],num,i,j,sta_r,sta_c,end_r,end_c,S;
	scanf("%d",&num);
	for(i=0;i<num;i++)
	{
		for(j=0;j<num;j++)
		{
			scanf("%d",&n[i][j]);
		}
	}
	for(i=0;i<num;i++)
	{
		if(n[i][0]==0)
		{
			sta_r=i;
			sta_c=0;
		}
	}
	for(j=0;j<num;j++)
	{
		if(n[0][j]==0)
		{
			sta_r=0;
			sta_c=j;
		}
	}
	for(i=0;i<num;i++)
	{
		if(n[i][num-1]==0)
		{
			end_r=i;
			end_c=num-1;
		}
	}
	for(j=0;j<num;j++)
	{
		if(n[num-1][j]==0)
		{
			sta_r=num-1;
			sta_c=j;
		}
	}
	for(i=1;i<num-1;i++)
	{
		for(j=1;j<num-1;j++)
		{
			if ((n[i][j]==0)&&(n[i+1][j]==0)&&(n[i][j+1]==0))
			{
				sta_r=i;
				sta_c=j;
			}
			if ((n[i][j]==0)&&(n[i-1][j]==0)&&(n[i][j-1]==0))
			{
				end_r=i;
				end_c=j;
			}

		}
	}
	S=(end_r-sta_r-1)*(end_c-sta_r-1);
	printf("%d",S);
	return 0;
}
int main()
{
	long n,i;
	int a=0,b,c,d,e,f;
	double sum=0;
	scanf("%ld",&n);
	f=0;
	for(i=1;i<=n*n;i++)
	{
		scanf("%d",&b);
		if(b==0)
		{
			f=i;
			sum+=i;
			a+=1;
		}
	}
	c=sum/a*2-f;
	d=f/n-c/n+1;
	e=(a-2*d)/2;
	printf("%d",(d-2)*e);
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	int picture[1000][1000];
	int hang[1000];
	int i,j;
	int m=0,mg=0,l=0,number;
	for(i=0;i<n;i++)
	{
		hang[i]=0;
		for(j=0;j<n;j++)
		{
			scanf("%d",&picture[i][j]);
			if(picture[i][j]==0)
			{
				hang[i]=hang[i]+1;
			}
		}
		if(hang[i]>2&&m==0)
		{
			m=i;
			mg=hang[i];
		}
		else if(hang[i]>2&&m>0)
		{
			l=i;
		}
	}
	number=(l-m-1)*(mg-2);
	printf("%d",number);

	return 0;
}
int main()
{
	int a[1000][1000],n,i,j,heng,shu;
	heng=0;
	shu=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			if(a[i][j]==0)heng++;
			if((a[i][j]==0)&&(a[i][j+1]!=0))break;
		}
		if((a[i][j]==0)&&(a[i][j+1]!=0))break;
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			if(a[j][i]==0)shu++;
			if((a[j][i]==0)&&(a[j+1][i]!=0))break;
		}
		if((a[j][i]==0)&&(a[j+1][i]!=0))break;
	}
	if(heng!=shu)printf("%d\n",abs(heng-shu)+1);
         else
         printf("%d\n",(heng-2)*(heng-2));	
return 0;
}
int main(){
  int n,i,j,c,ans=0,flag=0;
  scanf("%d",&n);
  for (i=1;i<=n;i++){
    for (j=1;j<=n;j++){
      scanf("%d",&c);
      if (!c){
        if (flag){
          ans=ans+j-flag-1;
          flag=0;
        }else flag=j;
      }
    }
    flag=0;
  }
  printf("%d",ans);
}
void main()
{
	int i,j;
	int n,m;
	int sum,num;
	int lon,wid;
	int c[100][100];
	scanf("%d",&n);
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				scanf("%d",&(c[i][j]));
		}
		}
		for(i=0;i<n;i++){
			sum=0;
			for(j=0;j<n;j++){
				if(c[i][j]==0)
					sum+=1;
			
				if(sum>2)
					lon=sum;	 
		}
		}
		for(j=0;j<n;j++){
			num=0;
			for(i=0;i<n;i++){
				if(c[i][j]==0)
					num+=1;
                                     if(num>2)
					wid=num;
		            }
		}
			m=(lon-2)*(wid-2);
			printf("%d\n",m);
}
int main(){
	int sz[1000][1000],i,j,n,flag=0,row1,row2,col1,col2;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
		   scanf("%d",&sz[i][j]);
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(sz[i][j]==0){
			     row1=i;
				 col1=j;
				 flag=1;
				 break;
			}
		}
		if(flag==1){
		    break;
		}
	}
	flag=0;
   for(i=n-1;i>=0;i--){
		for(j=n-1;j>=0;j--){
			if(sz[i][j]==0){
			     row2=i;
				 col2=j;
				 flag=1;
				 break;
			}
		}
		if(flag==1){
		    break;
		}
	}
   printf("%d",(row2-row1-1)*(col2-col1-1));

   return 0;
}
int main()
{
 int a,b,c,d,e,f,g,h;
 scanf("%d",&a);
 b=a%1000;
 c=(a-b)/1000;
 d=b%100;
 e=(b-d)/100;
 f=d%10;
 g=(d-f)/10;
 if(c==0)
  {
    if(e==0)
     {
       if(g==0)
        {
          if(f==0)
           printf("0");
          else
           printf("%d",f);
         }
       else
         {
         printf("%d%d",f,g);}
      }
     else
       {
        printf("%d%d%d",f,g,e);}
   }
 else                                       
 {
 printf("%d%d%d%d",f,g,e,c);}
}
int main()
{
    int n;
    cin>>n;
    int a[5];
    int count=1;
    for (int i=0;i<5;i++)
    {
        a[i]=n%10;
        if (n>=10)
        {
        n=(n-a[i])/10;
        count++;
        }
    }
    for (int i=0;i<count;i++)
    {
        cout<<a[i];
    }
    return 0;
}
int main()
{
	int n,a,b,c,d;
	cin>>n;
	if(n==10000)
		cout<<"00001"<<endl;
	else
	{
		if(n/1000>=1)
		{
			a=n/1000;
			b=(n-a*1000)/100;
			c=(n-a*1000-b*100)/10;
			d=n-a*1000-b*100-c*10;
			cout<<d<<c<<b<<a<<endl;
		}
		else
		{
			if(n/100>=1)
			{
               b=n/100;
			   c=(n-b*100)/10;
		    	d=n-b*100-c*10;
			  cout<<d<<c<<b<<endl;
			}
			else
			{
				if(n/10>=1)
				{
                  c=n/10;
		        	d=n-c*10;
			       cout<<d<<c<<endl;
				}
				else
					cout<<n<<endl;
			}
		}
	}
	return 0;
}
int main()
{
       int number,ge,shi,bai,qian,wan,place;
	scanf("%d",&number);
	if(number>=10000)
		place=5;
	else
	{
		if (number>=1000)
			place=4;
		else 
		{
			if (number>=100)
		    place=3;
			else
			{
				if (number>=10)
			    place=2;
				else
				place=1;

			}
		}
	}
	ge=number%10;
	shi=((number-ge)%100)/10;
	bai=((number-ge-10*shi)%1000)/100;
	qian=((number-ge-10*shi-100*bai)%10000)/1000;
	wan=(number-ge-10*shi-100*bai-1000*qian)/10000;

	switch(place)
	{
     case 5:printf("%d%d%d%d%d",ge,shi,bai,qian,wan);break;
     case 4:printf("%d%d%d%d",ge,shi,bai,qian);break;
     case 3:printf("%d%d%d",ge,shi,bai);break;
     case 2:printf("%d%d",ge,shi);break;
     case 1:printf("%d",ge);
     }
     return 0;
}
int main()
{
	char c[5];
	int i, t, k, l;   //k???????i????????
	scanf("%s", c);
	k=strlen(c);
	l=k/2;
	for(i=0;i<l;i++)
	{t=c[i];c[i]=c[k-i-1];c[k-i-1]=t;}
	printf("%s",c);
	return 0;
	}
main()
{
int i;
char str[100];
scanf("%s",&str);
for(i=strlen(str)-1;i>=0;i--)
printf("%c",str[i]);
getchar();
getchar();
}
int main()
{
 int i=0;
 char str[10000];
 scanf("%s",str);
 while(str[i]!='\0')
  i++;
 for(i--;i>=0;i--)
 printf("%c",str[i]);
 printf("\n");
 getchar();
 getchar();
 getchar();
 getchar();
}
int main()
{
    int n,i=1,m;
    int a[6]={0,0,0,0,0,0};
    cin>>n;     //???? 
    if(n>=10)
    { 
    do
    {
       a[i]=n%10;
       n=n/10;
       i=i+1;
    }while(n>=10);     //???????? 
    m=i-1;
    for(i=1;i<=m;i++) 
    cout<<a[i];
    cout<<n;
    }
    else cout<<n;                 //????? 
    return 0;
}
int main()
{
	int x,i,result=1;
	scanf("%d",&x);

	if(!x)
		printf("0");
	while(x)
	{
		printf("%d",x%10);
		x=x/10;
	}
	printf("\n",result);
	return 0;
}
int main()
{	
int x,k,a,b,c,d;
scanf("%d",&x);
if(x>999)
k=4;
else
if(x>99)
k=3;
else
if(x>9)
k=2;
else
k=1;
switch(k)
{
case 1: d=x;
printf("%d\n",d);break;
case 2:c=x/10;
d=x-10*c;
printf("%d%d\n",d,c);break;
case 3: b=x/100;
c=(x-100*b)/10;
d=x-100*b-10*c;
printf("%d%d%d",d,c,b);break;
case 4: a=x/1000;
b=(x-1000*a)/100;
c=(x-1000*a-100*b)/10;
d=x-1000*a-100*b-10*c;
printf("%d%d%d%d\n",d,c,b,a);break;
}

	return 0;
}
int main()
{
	int a;
	scanf("%d",&a);
	if(a/10==0)
		printf("%d",a);
	else if(a/100==0)
		printf("%d%d",a%10,a/10);
	else if(a/1000==0)
		printf("%d%d%d",a%10,a%100/10,a/100);
	else
		printf("%d%d%d%d",a%10,a%100/10,a%1000/100,a/1000);
	return 0;
}
int main()
{
	int m,n;
	int i=0;
	char c[100];
	
	char d[100];
	char e[100];
	gets(c);
	n=m=strlen(c);
	do
	{
		d[i]=c[m-1];
		m=m-1;
		i++;
	}while(m>=1);
	d[n]=32;
	sscanf(d,"%[^ ]",e);
	puts(e);
	scanf("%d",&m);
	return 0;
}
int main()
{
	char *p;
	p=(char *)malloc(sizeof(char)*8);
	int i;
	for(i=0;i<6;i++)
	{
		scanf("%c", p);
		if(*p=='\n')
		{
			*p=0;
			break;
		}
		p++;
	}
	for(i=i-1;i>=0;i--)
	{
		p--;
		printf("%c", *p);
	}
	return 0;
}
void main()
{
	long int n;
	int indiv,ten,hundred,thousand,place;
	scanf("%ld",&n);
	if(n>999)
		place=4;
	else if (n>99)
		place=3;
	else if (n>9)
		place=2;
	else place=1;
	thousand=n/1000;
	hundred=(int)(n-thousand*1000)/100;
	ten=(int)(n-thousand*1000-hundred*100)/10;
	indiv=(int)(n-thousand*1000-hundred*100-ten*10);
	switch(place)
	{
	case 4: printf("%d%d%d%d",indiv,ten,hundred,thousand);
	    break;
	case 3: printf("%d%d%d",indiv,ten,hundred);
		break;
	case 2: printf("%d%d",indiv,ten);
		break;
	case 1: printf("%d",indiv);
		break;
	}
}
int main()
{
int a=0,b=0;
cin>>a;
if(a!=0)
while(a!=0)
{
   b=a%10;
   cout<<b;
   a=a/10;
}
else
	cout<<0;


}
int main()
{int a=0;
scanf("%d",&a);
int b[6]={0,0,0,0,0,0};
int c[5]={-1,-1,-1,-1,-1};
b[0]=a;
int i;
for( i=1;i<5;i++)
{	
	b[i]=b[i-1]/10;
}
for(i=0;i<5;i++)
{if(b[i]!=0)
	{c[i]=b[i]-10*b[i+1];
	if(c[i]>=0)
		printf("%d",c[i]);}}
if(a==0)printf("0");
}
main()
{
    int n;
    scanf("%d",&n);
    printf("%d",n%10);
    if(n/10!=0)printf("%d",(n%100)/10);
    if(n/100!=0)printf("%d",(n%1000)/100);
    if(n/1000!=0)printf("%d",(n%10000)/1000);
    if(n/10000!=0)printf("%d",n/10000);
}
int main()
{
    int n, i = 10;
    cin >> n;
    if(n < 10)
        cout << n << endl;
    else
        if(n == 10)
        cout << 01 << endl;
        else
           {
                while(n > 0)
             {
                cout << n % i;
                n = n / i;

             }
           }
    return 0;
}
int main()
{
	int n,a,b,c,d;
	scanf("%d",&n);
	if(n<10)
	{
		printf("%d",n);
	}
	if((n>9)&&(n<100))
	{
		a=n/10;
		b=n%10;
		printf("%d%d",b,a);
	}
	if((n>99)&&(n<1000))
	{
		a=n/100;
		b=(n-a*100)/10;
		c=n%10;
		printf("%d%d%d",c,b,a);
	}
	if(n>999)
	{
		a=n/1000;
		b=(n-a*1000)/100;
		c=(n-a*1000-b*100)/10;
		d=n%10;
		printf("%d%d%d%d",d,c,b,a);
	}
	return 0;
}
int main()
{
    int n,a,b,c,d;
    scanf("%d",&n);
    a=n/1000;
    b=n/100-10*a;
    c=n/10-10*b-100*a;
    d=n-10*c-100*b-1000*a;
    if(a==0&&b==0&&c==0)printf("%d",d);
    if(a==0&&b==0&&c!=0){printf("%d",d);printf("%d",c);}
    if(a==0&&b!=0){printf("%d",d);printf("%d",c);printf("%d",b);}
    if(a!=0){printf("%d",d);printf("%d",c);printf("%d",b);printf("%d",a);}
    return 0;
}
int main()
{
	int a;
	int reverse(int m);
	scanf("%d",&a);
	reverse (a);
	return 0;
}
int reverse(int m)
{
	printf("%d",m%10);
	m=m/10;
	if (m!=0) return reverse(m);
}
int main()
{
	int n,a,b,c,d,s;
	scanf("%d",&n);
	if(n==10000) printf("00001");
	else if(n==1000) printf("0001");
	else if(n==100) printf("001");
	else if(n==10) printf("01");
	else
	{
		if(n/1000>0)
		{
		    a=n%10;
		    b=((n-a)/10)%10;
	 	    c=((n-a-b*10)/100)%10;
		    d=n/1000;
		    s=a*1000+b*100+c*10+d;
			printf("%d",s);
		}
		else
		{
			if(n/100>0)
			{
				a=n%10;
				b=((n-a)/10)%10;
				c=n/100;
				s=a*100+b*10+c;
				printf("%d",s);
			}
			else
			{
				if(n/10>0)
				{
					a=n%10;
					b=n/10;
					s=a*10+b;
					printf("%d",s);
				}
				else printf("%d",n);
			}
		}
	}
	return 0;
}
int main()
{
	int z;
	int a,b,c,d,e;
	scanf("%d",&z);
	a=(int)z/10000;
	z=z-a*10000;
	b=(int)z/1000;
	z=z-b*1000;
	c=(int)z/100;
	z=z-c*100;
	d=(int)z/10;
	e=z-d*10;
	if (a==0)
		if (b==0)
			if (c==0)
				if (d==0)
					printf("%d",e);
				else
					printf("%d%d",e,d);
			else
				printf("%d%d%d",e,d,c);
		else
			printf("%d%d%d%d",e,d,c,b);
	else
		printf("%d%d%d%d%d",e,d,c,b,a);
	scanf("%d",&z);
	return 0;
}
void main()
{
	int a,b,c,d,e,x,y=0;
	scanf("%d",&a);
	if(a<10)
	{
		printf("%d",a);
	}
    else if(a==10)
	{
		b=0;
	    c=1;
		printf("%d%d",b,c);
	}
	else if(a>10&&a<100)
	{
		b=a/10;
	    c=a-b*10;
		x=c*10+b;
		printf("%d",x);
	}
	else if(a==100)
	{
		b=1;
		printf("%d%d%d",y,y,b);
	}
	else if(a>100&&a<1000)
	{
		b=a/100;
	    c=(a-100*b)/10;
		d=a-100*b-10*c;
		x=d*100+c*10+b;
		printf("%d",x);
	}
	else if(a==1000)
	{
		b=1;
		printf("%d%d%d%d",y,y,y,b);
	}
	else if(a>1000&&a<10000)
	{
	b=a/1000;
	c=(a-b*1000)/100;
	d=(a-b*1000-c*100)/10;
	e=a-b*1000-c*100-d*10;
	x=e*1000+d*100+c*10+b;
	printf("%d",x);
	}
	else if(a==10000)
	{
		b=1;
		printf("%d%d%d%d%d",y,y,y,y,b);
	}
    return 0;
}
int main()
{
    char a[5] = {0};
    int i = 0;
    while ((a[i] = cin.get()) != '\n')
        i++;
        for ( ; i >= 0; i--)
            cout << a[i];
    return 0;
}
int main()
{
	int n,i,a[6];
	scanf("%d",&n);
	for(i=0;i<5;i++)
	{
		if(n==n%10)
		{
			i=i+5;
			printf("%d",n);
		}
		else
		{
			a[i]=n%10;
			n=n/10;
			printf("%d",a[i]);
		}
	}
	return 0;
}
int main()
{
	int a,b,c,d,e;
    scanf("%d",&a);
	b=a/1000;
	c=(a-b*1000)/100;
	d=(a-b*1000-c*100)/10;
	e=a-b*1000-c*100-d*10;	
	if(1000<=a&&a<=10000)
      printf("%d%d%d%d",e,d,c,b);
	else
		if(100<=a&&a<1000)
			printf("%d%d%d",e,d,c);
		else
			if(10<=a&&a<100)
				printf("%d%d",e,d);
			else 
				printf("%d",e);

	return 0;
}
int main()
{
	int a,b,c,d,e;
	scanf("%d",&a);
	b=a%10;
	c=(a%100-b)/10;
	d=(a%1000-b-c*10)/100;
	e=a/1000;
	if(e==0){
		if(d==0){
			if(c==0){
				printf("%d",b);
			}
			else {
				printf("%d%d",b,c);
			}
		}
		else{
			printf("%d%d%d",b,c,d);
		}
	}
	else {
		printf("%d%d%d%d",b,c,d,e);
	}
	return 0;
}
int e(int n)
{
	if(n==0)return 1;
	return 10*e(n-1);
}
int main() 
{ int N; int a[4]; int i=0; int t=0; int n=0; 
  while(scanf("%d",&N)!=EOF)
	  if(N)
  {i=t=n=0;
	  while(N%(1*e(i))!=N) 
	  { a[i]=(N%(1*e(i+1))-N%(1*e(i)))/(1*e(i)); i++; } 
	  while(t<=i-1) { printf("%d",a[t]); t++; } 
	  printf("\n");
  }
	  else printf("0\n");
  return 0;
}
int main()
{
	int x,a,b,c,d;
	scanf("%d",&x);
	a=x/1000;
	b=x/100%10;
	c=x/10%10;
	d=x%10;
	if(a==0)
		if(b==0)
			if(c==0)
				printf("%d",d);
			else printf("%d%d",d,c);
		else printf("%d%d%d",d,c,b);
	else printf("%d%d%d%d",d,c,b,a);
}
int main()
{
	int i,j,n,a[5];
	scanf("%d",&n);
	i=1;
	if (n==0) printf("0");
	while (n>0)
	{
		a[i]=n%10;
		n=n/10;
		i=i+1;
	}
	for(j=1;j<i;j++) printf("%d",a[j]);
	return 0;
}
void main()
{
int n,i,c,b;
scanf("%d",&n);
if(n==0)printf("0");
for(i=1;i<=n;)
{
	i=i*10;
	c=n%i;
	n=n-c;
	b=c*10/i;
	printf("%d",b);
}
printf("\n");
}
int main()
{
int a,b,c,d,e,f,t;
scanf("%d",&a);
b=a/10000;
c=(a-10000*b)/1000;
d=(a-10000*b-1000*c)/100;
e=(a-10000*b-1000*c-100*d)/10;
f=(a-10000*b-1000*c-100*d-10*e);
if(b!=0)
{
t=f;
f=b;
b=t;
t=e;
e=c;
c=t;
printf("%d%d%d%d%d",b,c,d,e,f);
}
else if(c!=0)
{t=f;
f=c;
c=t;
t=e;
e=d;
d=t;
printf("%d%d%d%d",c,d,e,f);
}
else if(d!=0)
{t=f;
f=d;
d=t;
printf("%d%d%d",d,e,f);
}
else if(e!=0)
{
t=f;
f=e;
e=t;
printf("%d%d",e,f);
}
else
printf("%d",f);

return 0;
}
int main()
{
    int n;
    int i;
    scanf("%d",&n);
    int k,count=0,s=1;
    int sum=0;
    while(n!=0)
    {
         k=n%10;
         if(k==0)
         count++;                
         n=n/10;
         sum=sum*10+k;
    }
    for(i=1;i<=count;i++)
    printf("0");
    printf("%d",sum);
    getchar();
    getchar();
}
int main()
{
	int a,b,c,d,n;
	scanf("%d", &n);
	if (n>=1 && n<=9)
	{
		printf("%d", n);
	}
	if (10<=n && n<=99)
	{
		a=n/10;
		b=n-a;
		printf("%d%d", b,a);
	}
	if (100<=n && n<=999)
	{
		a=n/100;
		b=(n-100*a)/10;
		c=n-a*100-b*10;
		printf("%d%d%d", c,b,a);
	}
	if (1000<=n && n<=9999)
	{
		a=n/1000;
		b=(n-1000*a)/100;
		c=(n-1000*a-b*100)/10;
		d= n-a*1000-b*100-c*10;
		printf ("%d%d%d%d",d,c,b,a);
	}
	return 0;
}
int main()
{
	char n;
	int p[6], i = 0, j = 0, k = 0;
	while( ( n =cin.get() ) != '\n' )
	{
		k = n - '0';
		p[i] = k;
		i++;
	}
	for ( j = ( i - 1 ); j >= 0; j = j - 1 )
	{
		cout << p[j];
	}
	return 0;
}
int main()
{
	int num,a,b,c,d;       //??????????10000??????????????
	cin>>num;
	a=num/1000;          //??????
	b=(num-a*1000)/100;   //??????
	c=(num-a*1000-b*100)/10;   //??????
	d=num-a*1000-b*100-c*10;   //??????
	if(a!=0)
		cout<<d<<c<<b<<a<<endl;    //??????
	else if(a==0&&b!=0)
		cout<<d<<c<<b<<endl;   //??????
	else if(a==0&&b==0&&c!=0)
		cout<<d<<c<<endl;   //??????
	else cout<<d<<endl;   //??????
	return 0;
}
int main()
{
	int a,b1,b2,b3,b4,b5;
	scanf("%d",&a);
	b1=a/10000;
	b2=a/1000-10*b1;
	b3=a/100-100*b1-10*b2;
	b4=a/10-1000*b1-100*b2-10*b3;
	b5=a-10000*b1-1000*b2-100*b3-10*b4;
	if(b1!=0)
	printf("00001");
	else if(b2!=0)
	printf("%d%d%d%d",b5,b4,b3,b2);
	else if(b3!=0)
	printf("%d%d%d",b5,b4,b3);
	else if(b4!=0)
	printf("%d%d",b5,b4);
	else printf("%d",b5);
}
int main()
{
    int n;
    scanf("%d", &n);
    int i=1;
    int k;
    int sum=0;
    int x[10];
    if(n==0)
    printf("0");
    else
    {
    while(n!=0)
    {
               
               x[i]=n%10;
               n=n/10;
               i++;
    }
    i=i-1;

    for(k=1;k<=i;k++)
    {
                     printf("%d", x[k]);
    }
    }

    return 0;
}
int main()  //?????
{
	int x,y,a[5],counter,i=0; //???????x?????y?????????a[5]??????counter?????i
	cin>>x; //????x
	do //????
	{
		y=x/10; //?y??x??????
		a[i]=x-y*10; //???????
		counter=i; //????
		i++; //?????1
		x=y; //y??x
		y=x*10; //??????????
	} while(y/10>0); //????
	for (i=0;i<=counter;i++) 
		cout<<a[i]; //?????
	return 0; //????
}
int main()
{
	int n;
	cin>>n;
	for(;;)
	{
		printf("%d",n%10);
		if(n<10)
			break;
		n=n/10;
	}
	return 0;
}
int main()
{
int n,i;char a[6];
gets(a);
n=strlen(a);
for(i=n-1;i>=0;i--)
{printf("%c",a[i]);}
}
main()
{ int n;
  int a,b,c,d;
  scanf("%d",&n);
  a=n%10;
  if(n<10) printf("%d",a);
  else if(n>9&&n<100){b=n/10;printf("%d%d",a,b);}
 else if(n>99&&n<1000){b=n/10%10;c=n/100;printf("%d%d%d",a,b,c);}
 else if(n>999&&n<10000){b=n/10%10;c=n/100%10;d=n/1000;printf("%d%d%d%d",a,b,c,d);}












return 0;
}
int main()
{
    char ch[10]={0};
    int i,s=0;
    gets(ch);
    i=0;
    while(ch[i]!='\0')
    {
        s=i;
        i++;
    }
    for(i=s;i>=0;i--)
    {
        printf("%c",ch[i]);
    }

}
int main()
{
	 int n,i,j,k,w,l;
	 scanf("%d",&n);
	 if(n-10<0) printf("%d",n);
	 else
	 {
		 if(n-100<0)
		 {
			 i=n%10;j=(n-i)/10;
		     printf("%d%d",i,j);
		 }
		 else
		 {
			 if(n-1000<0) 
			 {
				 i=n%10;j=((n-i)/10)%10;k=(n-i-10*j)/100;printf("%d%d%d",i,j,k);
			 }
			 else
			 {
				 if(n-10000<0)
				 {
					 i=n%10;j=((n-i)%100)/10;k=((n-i-10*j)%1000)/100;w=(n-i-10*j-100*k)/1000;
					 printf("%d%d%d%d",i,j,k,w);
				 }
			 }

		 }
	 }
	 return 0;
}
int main ()
{
	int n,x,y,z,w,p;
	scanf("%d",&n);
	if(n==10000)
		printf("00001");
    else
		if(n>999) p=4;
	    else 
			if(n>99) p=3;
	    else 
			if(n>9) p=2;
			else p=1;
	x=n/1000;y=(n-x*1000)/100;z=(n-x*1000-y*100)/10;w=n-x*1000-y*100-z*10;
    switch(p)
	{	
	case 4: printf("%d%d%d%d",w,z,y,x);break;
	case 3: printf("%d%d%d",w,z,y);break;
	case 2: printf("%d%d",w,z);break;
	case 1: printf("%d",w);break;
	}
}
int main()
{
	char num[5];
	int i,len;
	scanf("%s",num);

	len=strlen(num);
	for(i=len-1;i>=0;i--){
		printf("%c",num[i]);
	}
	printf("\n");
	return 0;
}
//********************
//??????
int main()
{
	int n,i=0,a[6];
	cin>>n;
	if(n==0)
		cout<<n;
	else 
		while(n>0)
	{
	     a[i]=n%10;
		 n=(n-a[i])/10;
		 cout<<a[i];
		 i++;
	}
	 return 0;

}
int main()
{
	int n,i,w,c;
	scanf("%d",&n);
	if (n>9999)
		printf("00001");
	else if (n>999)
		w=4;
	else if (n>99)
		w=3;
	else if (n>9)
		w=2;
	else printf("%d",n);

	for(i=1;i<w+1;i++)
	{   
		c=n%10;
		n=n/10;
		
		printf("%d",c);
	}


return 0;
}
int main(void)
{
	char x[6];
	gets(x);
	int i;
	
	for(i = 5;i >= 0;i--)
	if(x[i] == '0'||x[i] == '1'||x[i] == '2'||x[i] == '3'||x[i] == '4'||x[i] == '5'||x[i] == '6'||x[i] == '7'||x[i] == '8'||x[i] == '9') break;
	
	for(int j = i;j >= 0;j--)
	printf("%c",x[j]);
	
	return 0;
}
int main()
{
	char shu[6],temp;
	int i,Lshu;
	cin.getline(shu,6,'\n');
	Lshu=strlen(shu);
	for(i=0;i<Lshu/2;i++)
	{
		temp=shu[i];
		shu[i]=shu[Lshu-1-i];
		shu[Lshu-1-i]=temp;
	}
	cout<<shu;
	return 0;
}
int main ()
{
  int n,a,b,c,d,e,m;
  scanf("%d\n",&n);
  a=n/10000;
  b=(n-10000*a)/1000;
  c=(n-10000*a-1000*b)/100;
  d=(n-10000*a-1000*b-100*c)/10;
  e=n-10000*a-1000*b-100*c-10*d;
  if (n!=0 && n%10==0) printf("0");
  if (n!=0 && n%100==0) printf("0");
  if (a!=0)
      m=e*10000+d*1000+c*100+b*10+a;   
  else 
    if (b!=0)
      m=e*1000+d*100+c*10+b;
  else
    if (c!=0)
      m=e*100+d*10+c;
  else
    if (d!=0)
      m=e*10+d;
  else
    if (e!=0)
      m=e;
    else
      m=0;
  printf("%d\n",m);
  return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	if(n<10)
	{
		printf("%d",n);
	}
	else if((10<n)&&(n<100))
	{
		int i,j,k;
	    i=n/10;
	    j=n%10;
	    k=10*j+i;
	    printf("%d",k);
	}
	else if((100<n)&&(n<1000))
	{
		int a,b,c,d,e;
		a=n/100;
		b=n%100;
		c=b/10;
		d=b%10;
		e=100*d+10*c+a;
		printf("%d",e);
	}
	else if((1000<n)&&(n<10000))
	{
		int f,l,m,w,o,p,q;
		f=n/1000;
		l=n%1000;
		m=l/100;
		w=l%100;
		o=w/10;
		p=w%10;
		q=1000*p+100*o+10*m+f;
		printf("%d",q);
	}
	else if(n==10)
	{
		printf("01");
	}
		else if(n==100)
	{
		printf("001");
	}
		else if(n==1000)
	{
		printf("0001");
	}
	return 0;
}
void main()
{
 int a,b,c,d,e,g,h,i;
 long f;
 scanf("%ld",&f);
 a=f/10000;g=f%10000;
 b=g/1000;h=g%1000;
 c=h/100;i=h%100;
 d=i/10;e=i%10;
 if (a>0)
 printf("%d%d%d%d%d",e,d,c,b,a);
 else
  if(b>0)
  printf("%d%d%d%d",e,d,c,b);
  else
   if(c>0)
   printf("%d%d%d",e,d,c);
   else
    if(d>0)
    printf("%d%d",e,d);
    else
    printf("%d",e);
}
int main()
{
    int a[10],n=0,k=1,i=0,b=1;
    cin>>n;
	if(!n) cout<<n<<endl;
    for(i=0;n!=0;i++)
    {
        a[i]=n%10;
	cout<<a[i];
        n=(n-a[i])/10;
    }
    return 0;
}
int main()
{
	int n, a, b, c, d, e;
	cin >> n;
	a = n / 10000;
	b = (n - 10000 * a) / 1000;
	c = (n - 10000 * a - 1000 * b) / 100;
	d = (n - 10000 * a - 1000 * b - 100 * c) / 10;
	e = n - 10000 * a - 1000 * b - 100 * c - 10 * d;
	if(a != 0)
		cout << e << d << c << b << a << endl;
	else if(b != 0)
		cout << e << d << c << b << endl;
	else if(c != 0)
		cout << e << d << c << endl;
	else if(d != 0)
		cout << e << d << endl;
	else cout << e << endl;
	return 0;
}
int main()
{
	int n,a,b,c,d,e,f;
	cin>>n;
	if(n<10)
		cout<<n;
	else if(n<100)
		{a=n%10;
		b=n/10;
		cout<<a<<b;}
	else if(n<1000)
	{a=n%10;
	b=n/10;
	c=b%10;
	d=b/10;
	cout<<a<<c<<d;}
	else if(n<10000)
	{a=n%10;
	b=n/10;
	c=b%10;
	d=b/10;
	e=d%10;
	f=d/10;
	cout<<a<<c<<e<<f;}
	else if(n==10000)
		cout<<00001;
	return 0;
}
int main()
{
	int n,i,j;
	int a[5];
	scanf("%d",&n);
	a[0]=n/10000;
	a[1]=(n-a[0]*10000)/1000;
	a[2]=(n-a[0]*10000-a[1]*1000)/100;
	a[3]=(n-a[0]*10000-a[1]*1000-a[2]*100)/10;
	a[4]=n-a[0]*10000-a[1]*1000-a[2]*100-a[3]*10;
	for(i=0;i<=4;i++)
	{
		if(a[i])
		{
			for(j=4;j>=i;j--)
				printf("%d",a[j]);
			break;
		}
	}
	if(a[0]+a[1]+a[2]+a[3]+a[4]==0)
		printf("0");
	return 0;
}
int main()
{
	char str[10000]={0},*start,*end,t;
	int len;
	cin >> str;
	len = strlen(str);
	start = str;
	end = &str[len-1];
	while(start<end){
		t = *start;
		*start = *end;
		*end = t;
		start++;
		end--;
	}
	cout << str;
	return 0;
}
int main()
{
    int x,a[5],i,j,b[5],c,d,k;
    cin>>x;
    if (x==0)
        cout<<x;
    else
    {
        a[1]=x/10000;
        a[2]=(x%10000)/1000;
        a[3]=(x%1000)/100;
        a[4]=(x%100)/10;
        a[5]=(x%10);
        for (i=1;; i++)
        {
            if (a[i]!=0)
                break;
        }
        c=i;
        for (i=5; i>=c; i--)
            cout<<a[i];
    }
    return 0;
}
int main()
{
	
	int n,s=0,a,i,j=0;
	scanf("%d",&n);
	if(n==0)
	{
		printf("0");
	}
	else 
	{
		for(i=1;i<=5;i++)
		{
			a=n%10;
			if(a==0)
			{
				j=j+1;
			}
			n=n/10;
			s=s*10+a;
			if(n==0)
			{break;}
		}
		for(i=0;i<j;i++)
		{
			if(j==0)
			{break;}
			printf("0");
		}
		printf("%d",s);
	}
	return 0;
}
int main()
{
	int a,b,c,d,e,f,g;
	scanf("%d",&a);
	b=a/1000;
	c=a%1000;
	d=c/100;
	e=a%100;
	f=e/10;
	g=a%10;
	
	if(b==0)
	{
		if(d==0)
		{
			if(f==0)
			{
				printf("%d",g);
			}
			else
			{
				printf("%d%d",g,f);
			}
		}
		else
		{
			printf("%d%d%d",g,f,d);
		}
	}
	else
	{
		printf("%d%d%d%d",g,f,d,b);
	}
	return 0;
}
int main()
{
	int a,b,c,d,e,f;
	scanf("%d",&a);
	
		if(a>999)
			{
			
			c=a/1000;
			d=(a/100)-10*c;
			e=(a/10)-100*c-10*d;
			f=a-1000*c-100*d-10*e;
			
			printf("%d%d%d%d",f,e,d,c);
			}
		else
			if(a>99)
					{
					
					d=a/100;
					e=(a/10)-10*d;
					f=a-100*d-10*e;
					
					printf("%d%d%d",f,e,d);
					}
			else
				if(a>9)
					{
						
						e=(a/10);
						f=a-10*e;
						
						printf("%d%d",f,e);
					}
				else	
					{
						
						printf("%d",a);
					}
	
				
}