semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
 char a[200][200],b[200][200];
 int i,j,n,A[200],B[200],k;
 scanf("%d\n",&n);
 for(i=0;i<n;i++)
 {
  scanf("%s\n",&a[i]);
  scanf("%s\n",&b[i]);
  scanf("\n");
 }
for(i=0;i<n;i++)
 {
A[i]=strlen(a[i])-1;B[i]=strlen(b[i])-1;
for(j=A[i],k=B[i];k>0,k>=0;j--,k--)
{
 
 a[i][j]=a[i][j]-b[i][k]+48;
 
 while(a[i][j]<'0')
{a[i][j]+=10;
a[i][j-1]--;}
}
}
for(i=0;i<n;i++)
{printf("%s\n",a[i]);}
}
/*********************
*file:4.cpp
*author:?? 
*time:2013-10-19 
*description:?????????? 
***********************/
int main()
{
	int a[110], b[110], c[110];
	char str1[110], str2[110];
	int n, i, j;
	int len1, len2; 
	cin >> n; 
	while (n--) 
	{ 
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c)); //????????0
		cin >> str1 >> str2;
		len1 = strlen(str1);
		len2 = strlen(str2);
		j = 0;
		for (i = len1 - 1; i >= 0; i--) //?str1???a???
			a[j++] = str1[i] - '0';
		j = 0;
		for (i = len2 - 1; i >= 0; i--) //?str2???b???
			b[j++] = str2[i] - '0';
		for (i = 0; i < len1; i++) //?????
		{
			c[i] += (a[i] - b[i]);
			if (c[i] < 0) //??
			{
				c[i+1]--;
				c[i] += 10;
			}
		}
		i = len1 - 1;
		while (!c[i]) //???0???
		{
			i--;
			if(i == -1) 
				break;
		}
		if (i == -1) //????1???? 
		{
			cout<< 0 << endl;
			continue;
		}
		while(i >= 0)
		{
			cout << c[i];
			i--;
		}
		cout << endl;
	}
	return 0;
}
void plus(char a[],char b[])
{
	int * p1,* p2,*p;
	int c[100],i,l1,l2;
	l1=strlen(a);
	l2=strlen(b);
	for(i=0;i<l2;i++)
	{
		c[i]=a[l1-1-i]-b[l2-i-1];
		
	}
	for(i=l2;i<l1;i++)
	{
		c[i]=a[l1-i-1]-'0';
		
	}
	for(i=0;i<l1;i++)
	{
		if(c[i]<0)
		{
			c[i]=10+c[i];
			c[i+1]=c[i+1]-1;		
		}	
	}		
	p1=c;
	p2=p1+l1-1;
	for(p=p2;p!=p1;p--)
	{
		printf("%d",* p);
	}
	printf("%d\n",* p1);




	


}



void main()
{
	int n,i;
	char a[100][100],b[100][100];

	scanf("%d",&n);
	
	for(i=0;i<n;i++)
	{
		scanf("%s",a[i]);
		scanf("%s",b[i]);
		
	}

	for(i=0;i<n;i++)
	{
		plus(a[i],b[i]);
	}


}
int main()
{
	char a[101],b[101];
	int ia[101],ib[101];
	int n=0,i=0,j=0,len1=0,len2=0,t=0,ans[101]={0};
	cin>>n;
	for(t=0;t<n;t++)
	{
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		memset(ia,0,sizeof(ia));
		memset(ib,0,sizeof(ib));
		memset(ans,0,sizeof(ans));
		
		cin>>a>>b;
		len1=strlen(a);
		len2=strlen(b);
		int k=0;
		for(i=len1-1;i>=0;i--)
		{
			ia[k]=a[i]-'0';
			k++;
		}
		k=0;
		for(i=len2-1;i>=0;i--)
		{
			ib[k]=b[i]-'0';
			k++;
		}
		
		for(i=0;i<len2;i++)
		{
			if(ia[i]<ib[i])
			{
				ia[i+1]--;
				ia[i]=ia[i]+10;
				ans[i]=ia[i]-ib[i];
			}
			else
				ans[i]=ia[i]-ib[i];
		}
		int p=0;
		for(i=len1;;i--)
		{
			if(ia[i]!=0)
			{
				p=i;
				break;
			}
		}
		for(i=p;i>=len2;i--)
		{
			ans[i]=ia[i];
		}
		for(i=p;i>=0;i--)
			cout<<ans[i];
		cout<<endl;
	}
	return 0;
}
int main()
{
	int n,la,lb,i,j;
	char a[100],b[100];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",a);
	    scanf("%s",b);
		lb=strlen(b);
		la=strlen(a);
		for (j=lb-1;j>0;j--)
		{
			if (a[la-lb+j]>=b[j])
				a[la-lb+j]=a[la-lb+j]-b[j];
			else 
			{
				a[la-lb+j-1]=a[la-lb+j-1]-1;
				a[la-lb+j]=a[la-lb+j]+10-b[j];
			}
		}
		if (a[la-lb]<b[0])
		{
			a[la-lb-1]-=1;
			a[la-lb]=a[la-lb]+10-b[0];
		}
		else a[la-lb]=a[la-lb]-b[0];
        for (j=0;j<la-lb;j++)
			a[j]=a[j]-48;
		for (j=0;j<la;j++)
		    printf("%d",a[j]);
		printf("\n");
	}
	return 0;
}
int main()
{
    int n, i, j, k;
    int num1[110]; int num2[110];
    char str1[110]; char str2[110];
    cin >> n;
    getchar();
    for(i = 1; i <= n; i++)
    {
        j = 0;
        memset(num1, 0, sizeof(num1));
        memset(num2, 0, sizeof(num2));
        cin.getline(str1, 110);
        cin.getline(str2, 110);
        getchar();
        int l1 = strlen(str1);
        int l2 = strlen(str2);
        for(k = l1 - 1; k >= 0; k--)
            num1[j++] = str1[k] - '0';
        j = 0;
        for(k = l2 - 1; k >= 0; k--)
            num2[j++] = str2[k] - '0';
        for(k = 0; k < l2 || k < l1; k++)
        {
            num1[k] -= num2[k];
            if (k > 0 && num1[k - 1] < 0)
            {
                num1[k - 1] += 10;
                -- num1[k];
            }
        }
        k = 100;
        while (k > 0 && num1[k] == 0)
            -- k;
        for( ; k >= 0; k--)
            cout << num1[k];
        cout << endl;
    }
    return 0;
}
void main()
{
	int n,i,j,k,la,lb,t;
	char a[1000][100],b[1000][100],c[1000][100];
	scanf("%d",&n);
	getchar();
	for(i=1;i<=n;i++)
	{
		scanf("%s",a[i]);
		scanf("%s",b[i]);
		printf("\n");
	}
	
	for(i=1;i<=n;i++)
	{
		la=strlen(a[i]);
		lb=strlen(b[i]);
		for(j=la-1,k=lb-1;k>=0;j--,k--)
		{
			if(a[i][j]>=b[i][k]) c[i][j]=a[i][j]-b[i][k];
			else 
			{c[i][j]=a[i][j]-b[i][k]+10;
			a[i][j-1]--;}
		}
		for(j=la-lb-1;j>=0;j--)
		{
			if(a[i][j]>='0') c[i][j]=a[i][j]-'0';
			else 
			{c[i][j]=a[i][j]+10-'0';
			a[i][j-1]--;}
		}
		for(j=0;;j++)
			if(c[i][j]!=0) break;
			t=j;
		for(j=t;j<=la-1;j++)
		printf("%d",c[i][j]);
		printf("\n");
	}
}
void main()
{
	int n,i,j,k,t,m;
    char a[100][100],b[100][100];
	scanf("%d",&n);
	for(i=0;i<n-1;i++)
	{
		scanf("%s",a[i]);
	    scanf("%s\n",b[i]);
	}
	scanf("%s%s",a[n-1],b[n-1]);
    for(i=0;i<n;i++)
	{
		for(j=strlen(a[i])-1,k=strlen(b[i])-1;k>=0;j--,k--)
		{  
			if(a[i][j]>=b[i][k])
			  a[i][j]='0'+a[i][j]-b[i][k];
			else 
			{ 
				a[i][j]=10+'0'+a[i][j]-b[i][k];
				if(a[i][j-1]>'0') a[i][j-1]--;
				else 
				{
					for(t=j-1;a[i][t]=='0';t--)
						a[i][t]='9';
					a[i][t]--;
				}
			}
		}
		
	    printf("%s\n",a[i]);
	}
}
char a[200],b[200];
int alen;

void init(); 
void minus();
void output();

int main()
{
    int n,i;
    cin>>n;
    for (i=0;i<n;i++)
    {
        cin>>a>>b;
        init();
        minus();
        output();
    }
}

void init()
{
     int len1,len2,temp,i;
     alen=len1=strlen(a);
     for (i=0;i<(len1+1)/2;i++)
     {
         temp=a[i];
         a[i]=a[len1-i-1];
         a[len1-i-1]=temp;
     }
     for (i=0;i<len1;i++)
     {
         a[i]-='0';
     }
     len2=strlen(b);
     for (i=0;i<(len2+1)/2;i++)
     {
         temp=b[i];
         b[i]=b[len2-i-1];
         b[len2-i-1]=temp;
     }
     for (i=0;i<len2;i++)
     {
         b[i]-='0';
     }
     for (i=len2;i<len1;i++)
     {
         b[i]=0;
     }
}

void minus()
{
     int p,len,tp;
     p=0;
     while (p<alen)
     {
           if (a[p]>=b[p])
           {
                a[p]-=b[p];
           }
           else if (a[p]<b[p])
           {
                tp=p+1;
                while (a[tp]==0)
                {
                      a[tp]=9;
                      tp++;
                }
                a[tp]--;
                a[p]=a[p]+10-b[p];
           }
           p++;
     }
}

void output()
{
     int len,i,t;
     while (a[alen]==0)
     {
           if (alen==0)
           {
              cout<<0<<endl;     
              return;
           }
           alen--;
     }
     for (i=alen;i>=0;i--)
     {
         t=a[i];
         cout<<t;
     }
     cout<<endl;
}
char n1[100];
char n2[100];
char n3[101];
int w,i;

void do_sub();

void main() 
{
scanf("%d",&w);
for(i=0;i<w;i++)
{
 scanf("%s", n1);
 scanf("%s", n2);
 do_sub();
}
}
void do_sub()
{
 int iLen1;
 int iLen2;
 int iBorrow = 0;
 int n = 0;
 int sign = 0;

 iLen1 = strlen(n1);
 iLen2 = strlen(n2);
 if ((iLen2 > iLen1) || (iLen2 == iLen1) && (strcmp(n2, n1) > 0))
 {
  strcpy(n3, n1);
  strcpy(n1, n2);
  strcpy(n2, n3);
  sign = -1;
 }

 for(iLen1 = strlen(n1)-1, iLen2 = strlen(n2)-1; (iLen1 >= 0) && (iLen2 >= 0); iLen1--, iLen2--)
 {
  n3[n] = n1[iLen1] - n2[iLen2] - iBorrow;
  iBorrow = (n3[n] >= 0) ? 0 : 1;
  if (n3[n] < 0)
  {
   n3[n] += 10;
  }
  n++;
 }
 for(; iLen1 >= 0; iLen1--)
 {
  n3[n] = n1[iLen1] - '0' - iBorrow;
  iBorrow = (n3[n] >= 0) ? 0 : 1;
  if (n3[n] < 0)
  {
   n3[n] += 10;
  }
  n++;
 }

 if (sign == -1)
 {
  printf("-");
 }
 for(n--; n >= 0; n--)
 {
  printf("%d", n3[n]);
 }
 printf("\n");
}
//**********************************
//??: ?????
//???2013.11.16
//**********************************
int sub(int len,int *an1,int *an2)
{
	int max=0;
	for(int i=0;i<=len;i++)
	{
		an1[i]=an1[i]-an2[i];
		if(an1[i]<0)
		{
			an1[i]=an1[i]+10;
		    an1[i+1]=an1[i+1]-1;
		}
		if(an1[i]!=0)
			max=i;
	}
	return (max);
}
int main() 
{ 
	int n=0,i=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		char bn1[102],bn2[102];
		int j=0,k=0,max=0,an1[102],an2[102];
		cin>>bn1>>bn2;
		memset(an1,0,sizeof(an1));
		memset(an2,0,sizeof(an2));
		for(j=strlen(bn1)-1,k=0;j>=0;j--)
			an1[k++]=bn1[j]-'0';
		for(j=strlen(bn2)-1,k=0;j>=0;j--)
			an2[k++]=bn2[j]-'0';
         max=sub(strlen(bn1),an1,an2);
		 for(j=max;j>=0;j--)
			 cout<<an1[j];
		 cout<<endl;
	}
	return 0;
}
int main()
{
	int a1[Max+10]={0};
    int a2[Max+10]={0};
    char s1[Max+10];
    char s2[Max+10];
	int i,j,k=0,e,f,n;
	int L1,L2;
	scanf("%d",&n);
	do{
	scanf("%s",s1);
	scanf("%s",s2);
	L1=strlen(s1);
	L2=strlen(s2);
	j=0;
	if(L1==1&&L2==1)
	{
		e=s1[0]-'0';
		f=s2[0]-'0';
		printf("%d",e-f);
	}
	else
	{
	for(i=L1-1;i>=0;i--)
		a1[j++]=s1[i]-'0';
	j=0;
	for(i=L2-1;i>=0;i--)
		a2[j++]=s2[i]-'0';
	for(i=0;i<Max;i++)
	{
		a1[i]-=a2[i];
		if(a1[i]<0)
		{
			a1[i]+=10;
			a1[i+1]--;
		}
	}
	for(i=Max;i>=0;i--)
	{
		if(a1[i]!=0)
		{
			j=i;
            break;
		}
	}
	for(i=j;i>=0;i--)
	{
		printf("%d",a1[i]);
if(i==0)
printf("\n");
	}
	for(i=0;i<Max;i++)
	{
		a1[i]=0;
		a2[i]=0;
	}
	getchar();
	k++;
	}
	}while(k<n);
	return 0;
}
int main()
{
    char a[100],b[100];
    int n,k=1,p,q,i,c[100];
    scanf("%d",&n);
    while (k<=n)
    {
        scanf("%s%s",&a,&b);
        p=strlen(a);//??????
        q=strlen(b);//??????
        i=p;
        for(;p>=0;p--,q--)
        {
            if (q>=0)
            {
                c[p]=a[p]-b[q];
                if (c[p]<0) {c[p]=10+c[p];a[p-1]=a[p-1]-1;}
            }
            else if (q<0) c[p]=a[p]-48;
        }
        for(p=0;p<i;p++) printf("%d",c[p]);
        k++;
        printf("\n");
    }
}
void main()
{
    int i,j,k,n,t[100],n1,n2;
    char a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",a,b);
		n1=strlen(a);
		n2=strlen(b);
		for(j=n1-1,k=n2-1;k>=0;k--)
		{
			if(a[j]<b[k])
			{
                t[j]=a[j]-b[k]+10;
				a[j-1]=a[j-1]-1;
			}
			else 
			{
				t[j]=a[j]-b[k];
			}
			j--;
		}
		for(j=0;j<n1-n2;j++)
		{
			t[j]=a[j]-'0';
		}
		for(j=0;j<n1;j++)
		{
			printf("%d",t[j]);
		}
		printf("\n");
	}
}
void main()
{
	int n,i,j,k,ya,yb,m;
	char a[100]={0},b[100]={0};
	scanf("%d",&n);
	for(j=1;j<=n;j++)
	{
		scanf("%s\n",a);
		scanf("%s",b);
	
		
		ya=strlen(a);
		yb=strlen(b);
    	i=ya-1;
		for(k=yb-1;k>=0;k--)
		{
			if(a[i]>=b[k])
			{
				a[i]=a[i]-b[k]+48;
			}
			   
			
			else//if(a[i]<b[k])
			{
				a[i]=a[i]-b[k]+58;
				
				for(m=i-1;m>=0;m--)
					{
					  if(a[m]>=49)
						{
						  a[m]=a[m]-1;
							break;
						}

				      else if(a[m]==48)
						  a[m]=57;
					}
			
			}
			i--;
		}
		
			printf("%s",a);
		printf("\n");
	}
}
int main()
{
	char a[101],b[101];
	int A[100],B[100],ans[100];
	int line,len1,len2,len3;
	cin>>line;
	while(line>0)
	{
		cin>>a;
		cin>>b;
		len1=strlen(a);
		for(int i=len1-1,j=0;i>=0;i--,j++)
			A[j]=a[i]-'0';
		len2=strlen(b);
		for(int i=len2-1,j=0;i>=0;i--,j++)
			B[j]=b[i]-'0';
		for(int i=0;i<len2;i++)
		{
			if(A[i]>=B[i])
			   ans[i]=A[i]-B[i];
			else
			{
				A[i+1]--;
				ans[i]=A[i]-B[i]+10;
			}
		}
		for(int i=len2;i<len1;i++)
			ans[i]=A[i];
		if( len1==len2 && A[len1-1]==B[len2-1] )
			len1--;
		for(int i=len1-1;i>=0;i--)
			cout<<ans[i];
		cout<<endl;
		line--;
	}
	return 0;
}
/*
 * 88.cpp
 *
 *  Created on: 2011-12-25
 *      Author: 1
 */

int main()
{
	int n,aa,bb,i,j,p,q;
	cin>>n;
	char a[100];
    char b[100];
    char d[100];
    cin.getline(a,100);
	while(n>0)
	{
		n=n-1;
		cin.getline(a,100);
		cin.getline(b,100);
		cin.getline(d,100);
		aa=(strlen)(a);
		bb=(strlen)(b);
		for(i=aa;i>=0;i--)
		{
			b[i]=b[i-aa+bb];
		}
		for(i=0;i<aa-bb;i++)
		{
			b[i]='0';
		}
		int c[aa];
		for(i=aa-1;i>=0;i--)
		{
			p=(int)(a[i]);
			q=(int)(b[i]);
			if(p>=q) c[i]=p-q;
			else
			{
				c[i]=p+10-q;
				a[i-1]=(char)((int)(a[i-1])-1);
			}
		}
		for(i=0;i<100;i++)
		{
		    if(c[i]!=0) break;
		}
		for(j=i;j<100;j++)
		{
			c[j-i]=c[j];
		}
		for(j=0;j<aa-i;j++)
		{
			cout<<c[j];
		}
		cout<<endl;
	}
	return 0;
}
int maxi(int a,int b)
{
	if(a>b) return a;
	else return b;
}
int main()
{
   int n,i;
   char a[102],b[102];
   int na[102],nb[102],sum[200];
   cin>>n;
   for(i=0;i<n;i++)
   {   int j,k=0;
		memset(a,'\0',sizeof(a));
		memset(b,'\0',sizeof(b));
		memset(na,0,sizeof(na) );
		memset(nb,0,sizeof(na) );
		memset(sum,0,sizeof(sum) );
	   cin>>a>>b;
	   int lena=strlen(a),lenb=strlen(b);
	   for(j=lena-1;j>=0;j--)
		   na[k++]=a[j]-'0';
	   k=0;
	   for(j=lenb-1;j>=0;j--)
		  nb[k++]=b[j]-'0';
	   int MaxLen=maxi(lena,lenb);
	   for(j=0;j<MaxLen;j++)
	   {
		   sum[j]+=na[j]-nb[j];
		   if(sum[j]<0)
			 {  sum[j]+=10;
		        sum[j+1]--;
		   }
	   }
	   int flag=0;
	   for(j=MaxLen-1;j>=0;j--)
	   {   
		   if(sum[j]==0&&flag==0)
						;
		   if(sum[j]!=0&&flag==0)
		   {
			   flag=1;
			   cout<<sum[j];
		   }
		   else if(flag==1)
		   cout<<sum[j];
	   }
	   cout<<endl;
   }
   return 0;
		   

	   

}
int main()
{
	int str_1[100],str_2[100],str_3[100],n,k;
	char str_a[101],str_b[101];
	int len_a,len_b;
	cin>>n;
	for(k=0;k<n;k++)
	{
	cin.get();
	cin.getline(str_a,101);
	cin.getline(str_b,101);
	len_a=strlen(str_a);
	len_b=strlen(str_b);
	memset(str_1,0,sizeof(str_1));
	memset(str_2,0,sizeof(str_2));
	memset(str_3,0,sizeof(str_3));
	int i,j=0;
	for(i=len_a-1;i>=0;i--)
		str_1[j++]=str_a[i]-'0';
	j=0;
	for(i=len_b-1;i>=0;i--)
		str_2[j++]=str_b[i]-'0';
	for(i=0;i<len_b;i++)
	{
		if(str_1[i]>=str_2[i])
			str_3[i]=str_1[i]-str_2[i];
		else
		{
		    str_3[i]=str_1[i]-str_2[i]+10;
			str_1[i+1]--;
		}
	}
	for(;i<len_a;i++)
		str_3[i]=str_1[i];
	for(i=99;i>=0;i--)
	{
		if(str_3[i]!=0)
			break;
	}
	if(i==-1)
		cout<<0;
	else
		for(;i>=0;i--)
			cout<<str_3[i];
	cout<<endl;
	}
	return 0;
}


/*		
int main()
{ 
	const int MAX_LEN = 250;
	unsigned an1[MAX_LEN];
	unsigned an2[MAX_LEN];
	char seLine1[MAX_LEN + 1];
	char seLine2[MAX_LEN + 1];
	cin.getline(seLine1, MAX_LEN + 1);
	cin.getline(seLine2, MAX_LEN + 1);
	int nLen1 = strlen(seLine1);
	int nLen2 = strlen(seLine2);
	memset(an1, 0, sizeof(an1));
	memset(an2, 0,sizeof(an2));
	int i, j=0;
	for (i = nLen1-1;  i>=0; i--)
		an1[j++] = seLine1[i] - '0'; //???????????????
	j=0;
	for (i = nLen2-1; i>=0;i--)
		an2[j++] = seLine2[i] - '0';
	for (i = 0; i < MAX_LEN ;i++)
	{
		an1[i] += an2[i];
		if(an1[i] >= 10) //??????
		{
			an1[i] -=10;
			an1[i + 1]++; // i++?
		}
	}
	i = MAX_LEN - 1;
	for(;i>=0;i--)
		if(an1[i]!=0)
			break; //???????0??
	if(i==-1)
		cout<<0<<endl;
	else
	{
		for(;i >= 0; i--)
			cout << an1[i]; //??????
		cout << endl;
	}
	return 0;
}*/
/* Note:Your choice is C IDE */
main()
{
	void minus(char a[999],char b[999]);
	char a[999],b[999];
	int n,i,z;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s%s",a,b);
		minus(a,b);
	}
}
void minus(char a[999],char b[999])
{
	int x,y,w;
	x=strlen(a);
	y=strlen(b);	
	for(w=x-1;w>=x-y;w--)
	{
		    if(a[w]>=b[w-x+y]) 
		    {
		    	a[w]=a[w]-b[w-x+y];
		    }
		    else 
		    {
			    a[w-1]--;
			    a[w]=a[w]+10-b[w-x+y];
		    }
		
	}
    for(w=0;w<=x-1;w++)
    {
    	if(a[w]==0) continue;
    	else break;
    }
    for(w=w;w<=x-y-1;w++)
    printf("%c",a[w]);
    for(w=x-y;w<=x-1;w++)
    printf("%d",a[w]);
    printf("\n");
}
void main()
{
	int i,j,n,k,t;
	char c[100][100]={""},a[100]={""},b[100]={""};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		k=strlen(a);
		t=strlen(b);
		for(;k>0;k--,t--)
		{
			if(t<=0) c[i][k-1]=a[k-1];
			else if(a[k-1]>=b[t-1])
				c[i][k-1]=a[k-1]-b[t-1]+48;
			else if(a[k-1]<b[t-1])
			{
				c[i][k-1]=a[k-1]-b[t-1]+58;
				a[k-2]--;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=0;;j++)
			if(c[i][j]!='0') break;
		printf("%s\n",c[i]+j);
	}
}
void moin(char a[][100],char b[][100],int k)
{
	int c,d,e,f,i,j;
	char x[10][100];
	c=strlen(a[k]); d=strlen(b[k]); e=0;
	for(i=c-1;i>=c-d;i--)
	{f=(a[k][i]-48)-(b[k][i-c+d]-48)+e;
	 if(f>=0) e=0;
     else {e=-1;f=f+10;}
     x[k][i]=f+48;}
	for(i=c-d-1;i>=0;i--)
	{f=a[k][i]-48+e;
	 if(f>=0) e=0;
	 else {e=-1;f=f+10;}
     x[k][i]=f+48;}
	for(i=0;x[k][i]=='0';i++);
	for(j=i;j<=c-1;j++)
       printf("%c",x[k][j]);
	printf("\n");
}
int main()
{
   int n,i;
   char a[10][100],b[10][100];
   scanf("%d",&n);
   for(i=0;i<=n-1;i++)
   {scanf("%s%s",a[i],b[i]); 
    printf("\n");}
    for(i=0;i<=n-1;i++)
	   moin(a,b,i);
   return(0);
}
int main()
{
	int n, m; // ????????n?????n
	const int MAX_LEN = 100;

	cin >> n;
	cin.get();  // ????n????
	for(m = 0 ; m < n ; m++)
	{   
		int a[MAX_LEN + 1], b[MAX_LEN]; 
		
	    char str1[MAX_LEN + 1], str2[MAX_LEN + 1]; // ????????????
        
		cin.getline(str1,MAX_LEN + 1); //???????
	    cin.getline(str2,MAX_LEN + 1);
        
		
	    int len1 = strlen(str1), len2 = strlen(str2); // ????????

		memset(a,0,sizeof(a)); // ??????
		memset(b,0,sizeof(b));


	    int i, j = 0;
	    for(i = len1 - 1 ; i >= 0 ; i--)  // ??????????????
		    a[j++] = str1[i] - '0';
	    j = 0;
	    for(i = len2 - 1 ; i >= 0 ; i--)
		    b[j++] = str2[i] - '0';

	    for(i = 0 ; i < MAX_LEN ; i++) // ????
		{
		    a[i] -= b[i];

		    if(a[i] < 0)
			{
			    a[i] += 10;
			    a[i + 1]--;
			}
		}
		
		i = MAX_LEN;  // ??????????
		while(a[i] == 0)
		{
			i--;
		}
		for(; i >= 0 ; i--) // ????????
			cout << a[i];
		cout << endl;

		cin.get();  
	}

	return 0;
}
int main()
{
	
	int n, i, j, k, lenth1, lenth2,count;
	int num1[101], num2[101];
	char str1[101], str2[101];

    cin >> n;
								// ??/n
	for(count = 1; count <= n; count++)     //?????
	{
			cin.get();
		cin.getline(str1, 101);				//???????1
	
		cin.getline(str2, 101);				//?????2
	
		lenth1 = strlen(str1);				//????
		lenth2 = strlen(str2);
		memset(num1, 0, sizeof(num1));		//???????
		memset(num2, 0, sizeof(num2));
		k = 0;
		for(j = lenth1 - 1; j >= 0; j--)
		{
			num1[k++] = str1[j] -'0';       //???????????
		}
		k = 0;
        for(j = lenth2 - 1; j>=0; j--)
		{
			num2[k++] = str2[j] - '0';
		}
		for(k = 0; k < lenth1; k++)
		{
			if(num1[k] < num2[k])		   //???????????
			{
				num1[k] += 10;
				num1[k+1]--;
			}
		    num1[k] -= num2[k];
		}
		i = 100;
		while(num1[i] == 0)i--;				//?????????????
		for(; i >= 0; i--)
			cout << num1[i];
		cout << endl;
	}
	

	return 0;
}
int main()
{
	int n,i,j,k,str1[100]={0},str2[100]={0},len1,len2;
	char a[100]={0},b[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",a,b);
		len1=strlen(a),len2=strlen(b);
		k=0;
		for(j=len1-1;j>=0;j--)
		{
			str1[k++]=a[j]-'0';
		}
		k=0;
		for(j=len2-1;j>=0;j--)
		{
			str2[k++]=b[j]-'0';
		}
		for(j=0;j<len1;j++)
		{
			str1[j]-=str2[j];
			if(str1[j]<0)
			{
				str1[j]+=10;
				str1[j+1]--;
			}
		}
		for(j=len1-1;j>=0;j--)
			printf("%d",str1[j]);
		printf("\n");
		for(j=0;j<100;j++)
		{
			str1[j]=0;
		}
		for(j=0;j<100;j++)
		{
			str2[j]=0;
		}
		for(j=0;j<100;j++)
		{
			a[j]=0;
		}
		for(j=0;j<100;j++)
		{
			b[j]=0;
		}
	}
	return 0;
}
int main()
{
        int n,i,j,k,l,tem;
	char a[100][1000],b[100][1000];
	int c[100][1000];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin.get();
		cin.get(a[i],900);
		cin.get();
		cin.get(b[i],900);
		cin.get();
		for(j=strlen(a[i])-1;j>=strlen(a[i])-strlen(b[i]);j--)
		{
			c[i][j]=a[i][j]-b[i][j-strlen(a[i])+strlen(b[i])];
			if(c[i][j]<0)
			{
				c[i][j]=c[i][j]+10;
				a[i][j-1]=a[i][j-1]-1;
			}
		}
		for(j>=strlen(a[i])-strlen(b[i])-1;j>=0;j--)
		{
			c[i][j]=a[i][j]-'0';
		}
		for(j=0;j<strlen(a[i]);j++)
		{
			if(c[i][j]!=0)
			{
				tem=j;
				break;
			}
		}
		for(j=tem;j<strlen(a[i]);j++)
		{
			cout<<c[i][j];
		}
		cout<<endl;
	}
}
char a[100],b[100];int c[100];

int main()
{
    //freopen("1.in","r",stdin);
    //freopen("1.out","w",stdout);
    int n;
    cin>>n;
    while(n--)
    {
              cin>>a>>b;
              int lena=strlen(a);
              int lenb=strlen(b);
              for(int i=0;i<lena/2;i++)
               {
                      char t=a[i];
                      a[i]=a[lena-1-i];
                      a[lena-1-i]=t;
               }
               for(int i=0;i<lenb/2;i++)
               {
                      char t=b[i];
                      b[i]=b[lenb-1-i];
                      b[lenb-1-i]=t;
               }
               for(int i=0;i<lenb;i++)
               c[i]=a[i]-b[i];
               for(int i=lenb;i<lena;i++)
               c[i]=a[i]-'0';
               for(int i=0;i<lena-1;i++)
                 if(c[i]<0) {
                              c[i]=10+c[i];
                              c[i+1]-=1;
                            }
               for(int i=lena-1;i>=0;i--)
               {
                       if(c[i]!=0)
                       {
                                  for(int j=i;j>=0;j--)
                                  cout<<c[j];
                                  cout<<endl;
                                  break;
                       }
               }
    }
    return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		char a[101]={'0'},b[101]={'0'};
		scanf("%s\n%s",a,b);
		int lena,lenb;
		lena=strlen(a);
		lenb=strlen(b);
		int na[101]={0},nb[101]={0},nc[101]={0};
		int curr;
		for(curr=0;curr<lena;curr++){
			na[curr]=a[lena-1-curr]-'0';
		}
		for(curr=0;curr<lenb;curr++){
			nb[curr]=b[lenb-1-curr]-'0';
		}
		int r=0;
		for(curr=0;curr<lena;curr++){
			if(na[curr]-r>=nb[curr]){
				nc[curr]=na[curr]-r-nb[curr];
				r=0;
			}
			else{
				nc[curr]=na[curr]-r+10-nb[curr];
				r=1;
			}
		}
		printf("\n");
		if(nc[lena-1]!=0)printf("%d",nc[lena-1]);
		for(curr=lena-2;curr>=0;curr--)printf("%d",nc[curr]);
	}
	return 0;
}
void main()
{
	int i,j,n,p,q;
	char a[101],b[101],c[20][101],*s,d[5];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",a,b);
		gets(d);
		for(j=0;j<(p=strlen(a));j++)
		{
			if(j<(q=strlen(b)))
			{
				if(a[p-1-j]<b[q-j-1])
				{
					c[i][p-1-j]=10+a[p-1-j]-b[q-j-1]+'0';
					a[p-2-j]--;
				}
				else c[i][p-j-1]=a[p-1-j]-b[q-j-1]+'0';
			}
			else
			{
				if(a[p-1-j]<'0')
				{
					c[i][p-j-1]=10+a[p-1-j];
					a[p-j-2]--;
				}
				else c[i][p-j-1]=a[p-1-j];
			}
			c[i][p]='\0';

		}
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<p;j++)
		{
			if(c[i][j]!='0')
			{
				s=&c[i][j];break;
			}
		}
		printf("%s\n",s);
	}
}
main()
{
	char a[100][100]={0},b[100][100]={0};
	int n,m,i,j,c[100][100],k,l;
	scanf("%d",&k);
	for(l=0;l<k;l++)
	{
	scanf("%s",a[l]);
	//printf("Now input b:\n");
	scanf("%s",b[l]);
	
	}
	printf("\n");
	for(l=0;l<k;l++)
	{
	n=strlen(a[l]);
	m=strlen(b[l]);
	for(i=n-1,j=m-1;i>=0;i--,j--)
	{
		if(j>=0)
		{
			c[l][i]=a[l][i]-b[l][j];
			if(c[l][i]<0)
			{
				c[l][i]+=10;
				a[l][i-1]-=1;
			}
		}
		else 
			c[l][i]=a[l][i]-'0';
	}
	//printf("The result is:\n");
	for(i=0;i<n;i++)
		printf("%d",c[l][i]);
	printf("\n");
	}
	return 0;
}
int main()
{
	int a,b,i,j,n,m;
	char ss1[100],ss2[100];
	int s1[100],s2[100],s3[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	scanf("%s",ss1);
	scanf("%s",ss2);
		a=strlen(ss1);
		b=strlen(ss2);
		for(j=0;j<100;j++)
		{
			s1[j]=ss1[j]-48;
			s2[j]=ss2[j]-48;
		}
		for(j=b-1;j>=0;j--)
		{
			s2[j+a-b]=s2[j];
		}
		for(j=0;j<a-b;j++)
		{
			s2[j]=0;
		}
		for(j=a-1;j>=0;j--)
		{
			if(s1[j]>=s2[j])
				s3[j]=s1[j]-s2[j];
			else 
			{
				s3[j]=10+s1[j]-s2[j];
				s1[j-1]=s1[j-1]-1;
			}
		}
		for(j=0;j<a;j++)
		{
			if(s3[j]!=0)
			m=1;
			if(m==1)
				printf("%d",s3[j]);
		}
		printf("\n");
		m=0;
	}


	return 0;
}
void main()
{
	struct num
	{
	    char a[100],b[100];
	}jian[100];
	int n,j,i,m,l,p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	scanf("%s %s",jian[i].a,jian[i].b);
     m=strlen(jian[i].a);
	 l=strlen(jian[i].b);
	 for(j=m-1,p=l-1;j>=m-l,p>=0;j--,p--)
	 {
			jian[i].a[j]=48+jian[i].a[j]-jian[i].b[p];
		 if (jian[i].a[j] <48)
		 {
			 jian[i].a[j] +=10;
			jian[i].a[j-1]--;
		}
	 }
	}
	for(i=0;i<n;i++)
		printf("%s\n",jian[i].a);
}