semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	char str1[100],str2[100],a[100];
	int i,l1,l2,l,j,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",str1,str2);
		l2=strlen(str2);
        l1=strlen(str1);
		l=l1-l2;
		for(j=l2-1;j>=0;j--)
		{
			if(str1[l+j]>=str2[j]) 
				a[l+j]=str1[l+j]-str2[j];
			else 
			{
				a[l+j]=str1[l+j]+10-str2[j];
				str1[l+j-1]=str1[l+j-1]-1;
			}
		}
		for(j=0;j<l;j++) 
			a[j]=str1[j]-48; 
		for(j=0;j<l1;j++)
			printf("%d",a[j]);printf("\n");
	}
		    
			
}
void main()
{
	int n,i,j,k,m[60],l[30];
	char a[30][100];
	scanf("%d",&n);
	for(i=0;i<2*n;i++)
		scanf("%s",a[i]);
	for(i=0;i<2*n;i++)	
		m[i]=strlen(a[i]);
	for(i=0;i<n;i++)	
		l[i]=m[2*i]-m[2*i+1];

for(i=0;i<n;i++)
	{
		for(j=m[2*i+1]-1;j>=0;j--)
		{
			if(a[2*i+1][j]<=a[2*i][j+l[i]])
				a[2*i][j+l[i]]=a[2*i][j+l[i]]-a[2*i+1][j]+'0';
		else
			{
				a[2*i][j-1+l[i]]=a[2*i][j-1+l[i]]-1;
				a[2*i][j+l[i]]=a[2*i][j+l[i]]-a[2*i+1][j]+10+'0';
			}
		}
	}
for(i=0;i<n;i++)
	printf("%s\n",a[2*i]);


}
void f(char a[100],char b[100])
{
	int n1[100]={0},n2[100]={0},n3[100]={0};
	int i,j,k,t;
	
	// ?a[100]????n1[100]
	{i=99;
	while(a[i]==0)
		i=i-1;}
	{j=99;
	while(j>=99-i)
	{a[j]=a[i+j-99];j--;}}
	k=0;
	while(k<=98-i)
	{a[k]='0';k++;}
	for(t=0;t<=99;t++)
		n1[t]=a[t]-48;

	//?b[100]????n2[100]
	{i=99;
	while(b[i]==0)
		i=i-1;}
	{j=99;
	while(j>=99-i)
	{b[j]=b[i+j-99];j--;}}
	k=0;
	while(k<=98-i)
	{b[k]='0';k++;}
	for(t=0;t<=99;t++)
		n2[t]=b[t]-48;

	//?n1?n2?n3
	i=99;
	while(i>=0)
		{n3[i]=n1[i]-n2[i];
		i--;}

	for(j=99;j>=1;j--)
		{if(n3[j]<0)
		{n3[j]=n3[j]+10;k=j-1;
		n3[k]=n3[k]-1;
		}}
	j=1;
	while(n3[j]==0)j++;printf("\n");
	//????
	i=j;
	while(i<=99)
	{printf("%d",n3[i]);
	i++;}
	for(i=0;i<100;i++){n1[i]=0;n2[i]=0;n3[i]=0;}
}

void main()
{
	char tt[100][100]={0},uu[100][100]={0},tet[100][100]={0},iii[100][100]={0};
	int n,i;
	char a[10][100]={{0}},b[10][100]={{0}};char x[100]={0},y[100]={0},x1[100]={0},y1[100]={0};printf("%s",a[0]);
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s",a[i]);scanf("%s",b[i]);}
	for(i=0;i<n;i++)
		f(a[i],b[i]);
}
/********************************
 *?????						*
 *								*
 *  Created on: 2010-12-24		*
 *      Author: ??				*
 ********************************/
int main()
{
	char a[101],b[101];							//????????????????
	int n;
	cin>>n;										//?????????
	while(n>0)
	{
		cin.getline(a,101);
		cin.getline(a,101);						//???????
		cin.getline(b,101);
		int k=strlen(a)-1;
		for(int i=strlen(b)-1;i>=0;i--)			//????????????
		{

			if(a[k]>=b[i])
			{
				a[k]=a[k]-b[i]+48;				//?????????????????
			}
			else
			{
				a[k]=a[k]+10-b[i]+48;			//?????????
				int j=1;
				while(true)
				{
					if(a[k-j]!='0')
					{
						a[k-j]=a[k-j]-1;
						break;
					}
					else
					{
						a[k-j]='9';
						j++;
					}
				}
			}
			k--;
		}
		cout<<a<<endl;							//????????
		n--;
	}
	return 0;
}
void turn(char str[100])
{
	int n,i,t;
	n=strlen(str);
	for(i=0;i<=(n-1)/2;i++)
	{
		t=str[i];
		str[i]=str[n-i-1];
		str[n-i-1]=t;
	}
}

int min(int x,int y)
{
	int z;
	if(x>=y)
		z=y;
	else
		z=x;
	return(z);
}

void miner(char str1[100],char str2[100],char str3[100])
{
	int t,i,m,n;
	m=strlen(str1);
	n=strlen(str2);
	t=min(m,n);
	for(i=0;i<t;i++)
	{
		if(str1[i]>=str2[i])
			str3[i]=str1[i]-str2[i]+48;
		else
		{
			str3[i]=str1[i]+10-str2[i]+48;
			str1[i+1]--;
			str3[i+1]--;
		}
	}
}

void main()
{
	char a[100],b[100],t[2],c[100];
	int n,i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		gets(t);
		gets(a);
		gets(b);
		turn(a);
		turn(b);
		strcpy(c,a);
		miner(a,b,c);
		turn(c);
		puts(c);
	}
}
void main()
{
	int n,m;
	int i=0,j=0;
	char a[100][100],b[100][100],c[100][100]={0};
	int len1,len2;
	scanf("%d",&n);
	for(m=0;m<n;m++)
	{
		scanf("%s %s",a[m],b[m]);
		len1=strlen(a[m]);
		len2=strlen(b[m]);
		for(i=len1-1,j=len2-1;i>=len1-len2,j>=0;i--,j--)
		{
			if(a[m][i]-b[m][j]>=0)
			{
				c[m][i]=a[m][i]-b[m][j]+'0';
			}
			else
			{
				a[m][i-1]=a[m][i-1]-'1'+'0';
				c[m][i]=a[m][i]-b[m][j]+'0'+10;
			}
		}
		for(i=len1-len2-1;i>=0;i--)
		{
			if(a[m][i]>=0)
			{
				c[m][i]=a[m][i];
			}
			else
			{
				a[m][i-1]=a[m][i-1]-'1'+'0';
				c[m][i]=a[m][i]+'0'+10;
			}

		}
	}		
	for(m=0;m<n;m++)
	{
		printf("%s\n",c[m]);
	}
}
void main()
{   
	int n,la,lb,length,i,s,j;
	char a[100],b[100];
	int aArray[100],bArray[100];
	scanf("%d",&n);
    for(s=1;s<=n;s++)
	{
		scanf("%s",a);
		scanf("%s",b);
		
		la=strlen(a);
		lb=strlen(b);
		length=la-lb;
		
		for(i=0;i<la;i++)
			aArray[i]=a[i]-'0';
		for(i=0;i<length;i++)
	
			bArray[i]=0;

		for(i=length;i<la;i++) 
			bArray[i]=b[i-length]-'0';    
		
		for(i=la-1;i>=0;i--)
		{   
			if(aArray[i]>=bArray[i])a[i]=aArray[i]-bArray[i];
			if(aArray[i]<bArray[i])
			{a[i]=aArray[i]+10-bArray[i];aArray[i-1]--;}
			
			
		}
		
		for(i=0;i<la;i++)
		     a[i]=a[i]+48;
		
		for(i=0;i<la;i++)
		{
			if(a[i]!=0)
	     	for(j=i;j<la;j++)
			printf("%c",a[j]);
			printf("\n");
			break;
		}
	}
}
int main()
{ 	int n;
cin>>n;
   for(int t=0;t<n;t++)
	{cin.get();
		const int MAX_LEN = 200;
	int an1[MAX_LEN]; int 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);
	//cout<<seLine1<<endl<<seLine2<<endl;
	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++)
	{
		//printf("%d %d %d ",i, an1[i], an2[i]);
		if(an1[i]>=an2[i])
			an1[i]-=an2[i];
		else{
		     an1[i]=10+an1[i]-an2[i];
			 an1[i+1]-=1;
		}
		//printf("aa%d %d\n", i, an1[i]);
	}
	i = MAX_LEN - 1;
	while(an1[i]==0) i--;
	//cout<<i<<endl;
	for(;i >= 0; i--)
		cout << an1[i]; 
	cout << endl;
   }
	return 0;
}
int an1[100];
int an2[100];
char szLine1[100];
char szLine2[100];
void main()
{   
	int n,p,i,j,nLen1,nLen2,max=0;;
	scanf("%d",&n);
	for(p=0;p<n;p++)
	{
		scanf("%s",szLine1);
		scanf("%s",szLine2);
	
	memset(an1,0,sizeof(an1));
	memset(an2,0,sizeof(an2));
	
	nLen1=strlen(szLine1);
	j=0;

	for(i=nLen1-1;i>=0;i--)
	{
		an1[j++]=szLine1[i]-'0';
	}
	nLen2=strlen(szLine2);
	j=0;
	for(i=nLen2-1;i>=0;i--)
	{
		an2[j++]=szLine2[i]-'0';
	}
	if(nLen1>nLen2)
		max=nLen1-1;
	else
		max=nLen2;
	for(i=0;i<max;i++)
	{
		an1[i]-=an2[i];
		if(an1[i]<0)
		{
			an1[i]+=10;
			an1[i+1]--;
		}
	}
	for(i=max;i>=0;i--)
		printf("%d",an1[i]);
	printf("\n");
	}

}
//**************************
//*   ?????????   *
//*   ?  ?????       *
//*   ?  ??1000012738   *
//*   ?  ??2010.11.20   *
//**************************

int main()
{
	char a[101], b[101];                  //?????????????
	int c, d, n, i, j, k;                 //??????
	cin >> n;                             //??????
	for(i = 0; i < n; i ++)
	{
		cin >> a >> b;                    //?????
		c = strlen(a);                    //????
		d = strlen(b);
		int numa[100] = {0};              //????????????
		int numb[100] = {0};
		k = 0;                            //?????
		for(j = c - 1; j >=0; j --)       //??????
		{
			numa[k ++] = a[j] - '0';
		}
		k = 0;
		for(j = d - 1; j >= 0; j --)
		{
			numb[k ++] = b[j] - '0';
		}
		for(j = 0; j <= d; j ++)          //???????
		{
			numa[j] -= numb[j];
			if(numa[j] < 0)               //????????
			{
				numa[j] += 10;            //????
				numa[j + 1] --;
			}
		}
		j = c;
		while(numa[j] == 0)               //?????????0??
			j --;
		for( ; j >= 0; j --)              //??
			cout << numa[j];
		cout << endl;                     //??
	}
	return 0;
}
void main()
{
	int n,i,j,t,len1,len2;int k=0;
	char a[100],b[100],str3[100];
	int c[100];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
        scanf("%s%s",a,b);
		len1=strlen(a);
		len2=strlen(b);
		t=0;
		for(j=1;j<=len2;j++)
		{
			c[j]=t+a[len1-j]-b[len2-j]+10*(a[len1-j]+t<b[len2-j]);
		t=-1*(a[len1-j]-b[len2-j]+t<0);

		}
		if(len1-len2-1>=0)
		{
				for(j=len2+1;j<=len1;j++)
				{
					c[j]=t+a[len1-j]-48+10*(a[len1-j]-48+t<0);
				t=-1*(a[len1-j]-48+t<0);
				}
		}
       k=0;
		for(j=len1;j>=1;j--)
		{   
			if(c[j]==0)
				k++;
			else break;
		}
    for(j=len1-k;j>=1;j--)
	printf("%d",c[j]);
printf("\n");
	}
}
void main()
{
	int n, i, j, ta, tb, t;
	char a[50][100]={""}, b[50][100]={""}, blank[3];

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


	for(i=0; i<n; i++)
	{
	    ta = 0;
	    tb = 0;
		for(j=0; a[i][j]!='\0'; j++)
			ta++;
		for(j=0; b[i][j]!='\0'; j++)
			tb++;
		for(j=tb-1; j>=0; j--)
		{
			if(a[i][ta-tb+j]<b[i][j])
			{
				a[i][ta-tb+j] = a[i][ta-tb+j]+10-b[i][j]+48;
				for(t=ta-tb+j-1; t>=0; t--)
				{
					if(a[i][t]>48)
					{
						a[i][t]--;
						break;
					}
					else
					{
						a[i][t] = 57;
					}
				}
				
			}
			else
				a[i][ta-tb+j] = a[i][ta-tb+j]-b[i][j]+48;

		}
	}

	for(i=0; i<n; i++)
	{
		puts(a[i]);
	}

}
void main()
{
	char a[101],b[101];
	int n,i,k,j,c[101],l1,l2;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		for (j=0;j<=100;j++) c[j]=0;
		scanf("%s",a);
		scanf("%s",b);
		l1=strlen(a);
		l2=strlen(b);
		for (j=100;j>=101-l1;j--) a[j]=a[l1-101+j]-'0';
		for (j=100;j>=101-l2;j--) b[j]=b[l2-101+j]-'0';
		for (j=0;j<101-l1;j++) a[j]=0;
		for (j=0;j<101-l2;j++) b[j]=0;
		for (j=100;j>=100-((l1>l2)?l1:l2);j--)
		{
			c[j]+=a[j]-b[j];
			if (c[j]<0) {c[j]=c[j]+10; c[j-1]--;}
		}
		j=0;
		while (c[j]==0) j++;
		for (k=j;k<=100;k++) printf("%d",c[k]);
		printf("\n");
	}
}
main()
{
	char a[10][100],b[10][100];
	int i,j,n,k,l=0;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n-1;i++)
	{
		gets(a[i]);
		gets(b[i]);
		getchar();
	}
	gets(a[n-1]);
	gets(b[n-1]);
	for(i=0;i<n;i++)
	{
		k=strlen(a[i]);
		l=strlen(b[i]);
		for(j=0;j<l;j++)
		{
			if(a[i][k-j-1]<b[i][l-j-1])
			{
				a[i][k-j-1]=a[i][k-j-1]+10-b[i][l-j-1]+'1'-1;
				a[i][k-j-2]--;
			}
			else
				a[i][k-j-1]=a[i][k-j-1]-b[i][l-j-1]+'1'-1;
		}
		for(j=0;j<k;j++)
			printf("%c",a[i][j]);
		printf("\n");
	}
}
/*************************
??cpp4
?????
???
2013/11/14
**************************/
int main()
{
	int m, n, i, j, k , c[102]={0}, d[102]={0}, e[102]={0} ,l1, l2;
	char a[102], b[102];
	cin >> n;
	cin.get();
	for (i=1; i<=n; i++)
	{
		memset(a, 0, sizeof(a));
        memset(b, 0, sizeof(b));
        memset(c, 0, sizeof(c));
        memset(d, 0, sizeof(d));
		memset(e, 0, sizeof(e));
		cin.getline(a,100);
		cin.getline(b,100);
		cin.get();
		l1 = strlen (a);
		l2 = strlen (b);
		for (j = l1-1, k=0; j>=0, k<= l1-1; j--, k++)
			c[k] = a[j] - '0';
		for (j = l2-1, k=0; j>=0, k<= l2-1 ; j--, k++)
			d[k] = b[j] -'0';
		for (j=0; j<=101; j++)
		{
			if (c[j]<d[j])
			{
				e[j]= c[j]+10-d[j];
				c[j+1]--;
			}
			else
				e[j] = c[j]-d[j];
		}
		for(j=101; e[j]== 0 ; j--)
			m=j;
		for (k=m-1; k>=0; k--)
			cout << e[k];
		cout << endl;
	}
	return 0;
}
int str2(char*str,int*a)
{
	int length=(int)strlen(str);
	int i;
	for(i=0;i<length;i++)
		a[length-i-1]=str[i]-'0';
	return length;
}
void print_b(int*a,int length)
{
	int t=length-1;
	int i;
	while(a[t]==0 && t>0)
		t--;
	for(i=t;i>=0;i--)
		printf("%d",a[i]);
}
int sub_b(int*a,int alength,int*b,int blength,int*c)
{
	int i;
	for(i=0;i<alength;i++)
	{
		c[i]=a[i];
		if(i<blength)
			c[i]-=b[i];
	}
	for(i=0;i<alength;i++)
		if(c[i]<0)
		{
			c[i+1]--;
			c[i]+=10;
		}
	return c[alength-1]?alength:(alength-1);
}
void main()
{
	char s1[M],s2[M];
	int a[M],b[M],c[M];
	int alength,blength,clength;
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",s1,s2);
	    alength=str2(s1,a);
	    blength=str2(s2,b);
	    clength=sub_b(a,alength,b,blength,c);
	    print_b(c,clength);
	    printf("\n");
	}
}
main()
{
	int n,i,j,t,as,bs;
	char a[100][100],b[100][100];
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%s",a[i]);
		scanf("%s",b[i]);
		getchar();
	}
	for (i=1;i<=n;i++)
	{
		as=strlen(a[i]);
		bs=strlen(b[i]);
		for (j=0;j<as;j++)
			a[i][j]-='0';
		for (j=0;j<bs;j++)
			b[i][j]-='0';
		for (j=1;j<=bs;j++)
		{
			a[i][as-j]-=b[i][bs-j];
			if (a[i][as-j]<0) 
			{
				a[i][as-j-1]--;
				do
				a[i][as-j]+=10;
				while (a[i][as-j]<0);
			}
		}
		t=0;
		while (a[i][t]==0)
			t++;
		for (j=t;j<as;j++)
			printf("%d",a[i][j]);
		printf("\n");
	}
	return 0;
}
int main()
{  
	int n, num1[101], num2[101], len1, len2, m, j;
	char str1[102], str2[102];

	cin >> n;
	cin.get();
	for (int k = 1; k <= n; k++)
	{
		cin.getline(str1,102);
		cin.getline(str2,102);
                cin.get();
		len1 = strlen (str1);
		len2 = strlen (str2);
		memset(num1, 0, sizeof(num1));
        memset(num2, 0, sizeof(num2));
		j = 0;
		for (int i = len1 - 1; i >= 0; i--)
		{
			num1[j] = str1[i] - '0';
			j++;
		}
		j = 0;
		for (int i = len2 - 1; i >= 0; i--)
		{
			num2[j] = str2[i] - '0';
			j++;
		}
		for (int i = 0; i < len1; i++)
		{
			num1[i] = num1[i] - num2[i];
			if (num1[i] < 0)
			{
				num1[i + 1]--;
				num1[i] += 10;
			}
		}
		m = len1;
		while (num1[m] == 0)
			m--;
		for (int i = m; i >= 0; i--)
			cout << num1[i];
		cout << endl;
	}

	return 0;

}
int main()
{
	int n,i;
	char a[200]={'0'},b[200]={'0'};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		char c[200]={'0'};
		int lena,lenb;
		int d,j;
		scanf("%s",a);
		scanf("%s",b);
		lena=strlen(a);
		lenb=strlen(b);
		d=lena-lenb;
		for(j=lena-1;j>=d;j--)
		{
			b[j]=b[j-d];
			b[j-d]='0';
		}
		for(j=0;j<d;j++) b[j]='0';
		for(j=lena-1;j>=0;j--)
		{
			if(a[j]>=b[j])
				c[j]=a[j]-b[j]+'0';
			else
			{
				c[j]=a[j]-b[j]+10+'0';
				a[j-1]-=1;
			}
		}
		for(j=0;j<lena;j++)
			printf("%c",c[j]);
		printf("\n");
	}
return 0;
}
int main(){
	int n,i,j,k,la,lb;
	char a[101],b[101];
	int c[101];
	cin>>n;
	while(n!=0){
		cin>>a>>b;
		la=strlen(a);
		lb=strlen(b);
		for(i=la-1,j=lb-1,k=0;j>=0;i--,j--,k++){
			if(a[i]>=b[j]) c[k]=a[i]-b[j];
			else{
				c[k]=a[i]-b[j]+10;
				a[i-1]=a[i-1]-1;
			}
		}
		for(;i>=0;i--,k++)
			c[k]=a[i]-'0';
		for(i=k-1;i>=0;i--){
			cout<<c[i];
		}
		cout<<endl;
		n--;
	}
	return 0;
}
int main()
{
	int n,i,l,e;
	char a[101],b[101];
	int c[101],d[101];//??????
	cin>>n;
	while(n--)
	{
		int t;
		cin>>a>>b;
		for(i=0;i<=(strlen(a)-1)/2;i++)
		{
			t=a[i];
			a[i]=a[strlen(a)-1-i];
			a[strlen(a)-1-i]=t;
		}
		for(i=0;i<=(strlen(b)-1)/2;i++)
			{
				t=b[i];
				b[i]=b[strlen(b)-1-i];
				b[strlen(b)-1-i]=t;
			}//?????

		/*		strrev(a);
				strrev(b);????wtf???????????????
		 */
		for(i=0;i<(int)strlen(a);i++)//??????
			c[i]=a[i]-48;
		for(i=0;i<(int)strlen(b);i++)
			d[i]=b[i]-48;
		for(i=0;i<(int)strlen(b);i++)//???
			c[i]-=d[i];
		for(i=0;i<(int)strlen(a);i++)//??
			if(c[i]<0)
			{
				c[i]+=10;
				c[i+1]--;
			}
		l=0,e=0;
		for(i=(int)strlen(a)-1;i>=0;i--)//????
		{
			if((c[i]==0)&&(e==0))
				continue;
			l++;
			e=1;
		}
		if(l==0)
			l++;
		for(i=l-1;i>=0;i--)//??
			cout<<c[i];
		cout<<endl;
	}
	return 0;
}
// * * * * * * * * * * * * * * *
// *????????           *
// *??????  1300013011   *
// *???2013.11.16           *
// * * * * * * * * * * * * * * *
int main()
{
	int n, i, j, k, len1, len2, num1[101] = {0}, num2[101] = {0}, num[101] = {0};
	char str1[200], str2[200];
	cin >> n;
	cin.get();
	for (i = 1; i <= n; i++)
	{
		memset (num1, 0, sizeof(num1));
		memset (num2, 0, sizeof(num2));
		memset (num, 0, sizeof(num));
		cin.getline(str1, 101);
		cin.getline(str2, 101);
		if (i!=n) 
			cin.get(); 
	    len1 = strlen(str1);
		len2 = strlen(str2);
		for (j = 0, k = len1 - 1; k >= 0; j++, k--)
			num1[j] = str1[k] - '0';
		for (j = 0, k = len2 - 1; k >= 0; j++, k--)
			num2[j] = str2[k] - '0';
		for (j = 0; j < len1; j++)
		{
			if (num1[j] >= num2[j])
				num[j] = num1[j] - num2[j];
			else
			{
				num[j] = num1[j] + 10 - num2[j];
				k = j + 1;
				while (num1[k] == 0)
				{
					num1[k] = 9;
					k++;
				}
                num1[k]--;
			}
		}
        for (j = len1 - 1; j >= 0; j--)
		{
			if (num[j] != 0)
			{
				for (k = j; k >= 0; k--)
		            cout << num[k];
				break;
			}		
		}
		cout << endl;
	}
	return 0;
}
int max(int a,int b)
{
	int c;
	if(a>b) c=a;
	else c=b;
	return (c);
}

void main ()
{
	char str1[100],str2[100],temp;
	char c[100]={0};
	int i,j,k,n,l,flag,x,y;
	flag=0;
	
	
	scanf("%d",&n);
	
	for(i=0;i<100;i++)
	{
		c[i]='0';
		str1[i]='0';
		str2[i]='0';
	}




	
	for(l=0;l<n;l++)
	{
		for(i=0;i<100;i++)
		{
			c[i]='0';
			str1[i]='0';
			str2[i]='0';
		}

		scanf("%s",str1);
		scanf("%s",str2);
		x=strlen(str1);
		y=strlen(str2);
		k=max(x,y);
		str1[x]='0';
		str2[y]='0';
		
		
		for(i=0;i<=(x-1)/2;i++)
		{
			c[0]=str1[i];
			str1[i]=str1[x-1-i];
			str1[x-1-i]=c[0];
		}


		for(i=0;i<=(y-1)/2;i++)
		{
			temp=str2[i];
			str2[i]=str2[y-1-i];
			str2[y-1-i]=temp;
		}

		for(i=0;i<k;i++)
		{
			if(flag==1)                {str1[i]-=1;flag=0;}
			if(str1[i]<str2[i])        {c[i]=10+(str1[i]-'0')-(str2[i]-'0')+'0';flag=1;}
			else if(str1[i]>=str2[i])  {c[i]=(str1[i]-'0')-(str2[i]-'0')+'0';}               
		}
		
		if(c[k-1]=='0')
		{
			for(i=0;i<=(k-2)/2;i++)
			{
				temp=c[i];
				c[i]=c[k-2-i];
				c[k-2-i]=temp;
			}
			for(i=0;i<k-1;i++)
			{
				printf("%c",c[i]);
			}
			printf("\n");
		}

		if(c[k-1]!='0')
		{
			for(i=0;i<=(k-1)/2;i++)
			{
				temp=c[i];
				c[i]=c[k-1-i];
				c[k-1-i]=temp;
			}
			
			for(i=0;i<k;i++)
			{
				printf("%c",c[i]);
			}
			printf("\n");
		}
	}
}
void main()
{
	int n,i,j;
	char *p,*q;
	char sum[20][100],da[20][100];
	int	c[20],d[20];
	scanf("%d\n",&n);                                     
	for(i=0;i<n-1;i++)
	{
		scanf("%s",sum[i]);
		scanf("%s",da[i]);
		c[i]=strlen(sum[i]);
		d[i]=strlen(da[i]);
		scanf("\n");
	}
	scanf("%s",sum[n-1]);
	scanf("%s",da[n-1]);
    c[n-1]=strlen(sum[n-1]);
	d[n-1]=strlen(da[n-1]);
    for(i=0;i<n;i++)
	{
	    for(p=&sum[i][c[i]-1],q=&da[i][d[i]-1],j=0;j<d[i];j++,p--,q--)
			if(*p>=*q)sum[i][c[i]-1-j]=*p-*q+48;
			else if(*p<*q){sum[i][c[i]-1-j]=*p-*q+58;*(p-1)=*(p-1)-1;}
	}
	for(i=0;i<n;i++)
		printf("%s\n",sum[i]);
}
void jf(char *a,int n,char *b,int m)
  {
    int i,j,k;
	for(i=m-1,j=n-1;i>=1;i--,j--)
	  {
	    if(a[j]>=b[i])
		a[j]=a[j]-b[i]+'0';
		else 
		 {
		   a[j]=a[j]-b[i]+10+'0';
		   a[j-1]--;
		 }
	  }
	if(n==m)
	{a[0]=a[0]-b[0]+'0';
	  for(i=0;i<n;i++)
	 printf("%c",a[i]);
	 }
	else 
	 {
	   if(a[n-m]>=b[0])
	   a[n-m]=a[n-m]-b[0]+'0';
	   else 
	   {
	     a[n-m]=a[n-m]-b[0]+10+'0';
		 a[n-m-1]--;
		  for(k=n-m-1;k>=0;k--)
		  {
		    if(a[k]>='0')
			 break;
			 else 
			 {
			 a[k]=9+'0';
			  a[k-1]--;
			  }
		   }
		}
         for(i=0;i<n;i++)
	      printf("%c",a[i]);
	}
}
int main()
{
 int n,i;
 scanf("%d",&n);
 char **pp;
  pp=(char**)malloc(n*sizeof(char*));
  for(i=0;i<n;i++)
  pp[i]=(char*)malloc(101*sizeof(char));
   char **qq;
  qq=(char**)malloc(n*sizeof(char*));
  for(i=0;i<n;i++)
  qq[i]=(char*)malloc(101*sizeof(char));
   for(i=0;i<n-1;i++)
   {
	   scanf("%s",pp[i]);
       scanf("%s",qq[i]);
	printf("\n");
   }
       scanf("%s",pp[n-1]);
       scanf("%s",qq[n-1]);
   int *p,*q;
    p=(int*)malloc(n*sizeof(int));
	q=(int*)malloc(n*sizeof(int));
 for(i=0;i<n;i++)
 {
   p[i]=strlen(pp[i]);
   q[i]=strlen(qq[i]);
  }
 for(i=0;i<n;i++)
 {
 jf(pp[i],p[i],qq[i],q[i]);
    printf("\n");
 }
 for(i=0;i<n;i++)
	 free(pp[i]);
	 free(pp);
 for(i=0;i<n;i++)
	 free(qq[i]);
	 free(qq);
	 free(p);
      free(q);
}
/*
 *??? 
 *2010 - 11 - 18 
 *?????1 - ????? 
 */
int main()
{
    int m, n;
    cin >> n;
    for ( m = 1; m <= n; m++ )
    {
        char str1[100], str2[100];
        cin >> str1 >> str2;//????????? 
        int num1[100], num2[100];
        int l1, l2, i, j;
        l1 = strlen(str1);
        l2 = strlen(str2);
        for ( i = l1 - 1, j = 0; i >= 0; i-- )//???????int??????????? 
        {
            num1[j] = str1[i] - '0';
            j++;
        }
        for ( i = l2 - 1, j = 0; i >= 0; i-- )
        {
            num2[j] = str2[i] - '0';
            j++;
        }
        for ( i = 0; i < l2; i++ )//???? 
            num1[i] = num1[i] - num2[i];
        for ( i = 0; i < l1; i++ )//???????????1 
            if ( num1[i] < 0 )
            {
                 num1[i] += 10;
                 num1[i + 1] -= 1;
            }
        if ( num1[l1 - 1] != 0 )//??????????????? 
           for ( i = l1 - 1; i >= 0; i-- )
               cout << num1[i];
        else
            for ( i = l1 - 2; i >= 0; i-- )
                cout << num1[i];
        cout << endl;
    }
    return 0;
}
void main()
{
	int n,i,j,k,l,m;
	char a[50][100];
	scanf("%d",&n);
	for(i=0;i<=2*n-2;i=i+2)
	{
	    scanf("%s",a[i]);
		scanf("%s",a[i+1]);
		printf("\n");
	}
	for(i=0;i<=2*n-2;i=i+2)
	{
		for(j=0;a[i][j]!='\0';j++)	
		    ;
		for(k=0;a[i+1][k]!='\0';k++)	
		    ;
		if(j>k)
		{
			for(l=j-1;l>=j-k;l=l-1)
				a[i+1][l]=a[i+1][l-j+k];
            for(l=j-k-1;l>=0;l=l-1)
				a[i+1][l]=48;
			for(l=j-1;l>=0;l=l-1)
			{
				if(a[i][l]>=a[i+1][l])a[i][l]=a[i][l]-a[i+1][l]+48;
				else 
				{
					a[i][l]=a[i][l]+10-a[i+1][l]+48;
					a[i][l-1]=a[i][l-1]-1;
				}
			}
			if(a[i][0]!=48)
			for(l=0;l<=j-1;l++)printf("%c",a[i][l]);  
			else
			{
			    for(l=0;a[i][l]==48;l++);
				for(m=0;m<=j-1-l;m++)
				{
					a[i][m]=a[i][m+l];
					printf("%c",a[i][m]);
				}
			}
			printf("\n");
		}

		if(j<k)
		{
			printf("-");
			for(l=k-1;l>=k-j;l=l-1)
				a[i][l]=a[i][l-k+j];
            for(l=k-j-1;l>=0;l=l-1)
				a[i][l]=48;
			for(l=k-1;l>=0;l=l-1)
			{
				if(a[i+1][l]>=a[i][l])a[i+1][l]=a[i+1][l]-a[i][l]+48;
				else 
				{
					a[i+1][l]=a[i+1][l]+10-a[i][l]+48;
					a[i+1][l-1]=a[i+1][l-1]-1;
				}
			}
			if(a[i+1][0]!=48)
			   for(l=0;l<=k-1;l++)printf("%c",a[i+1][l]);
			else
			{
			    for(l=0;a[i+1][l]==48;l++);
				for(m=0;m<=k-1-l;m++)
				{
					a[i+1][m]=a[i+1][m+l];
					printf("%c",a[i+1][m]);
				}
			}
			printf("\n");
		}
		if(j==k)                             
		{
			for(l=0;l<=j-1;l++)
				if(a[i][l]-a[i+1][l]!=0)break;
			if(l==j)printf("0");
			else
			{
			    for(l=j;l>=1;l=l-1)
				    a[i][l]=a[i][l-1];
			    a[i][0]=49;
			    for(l=j;l>=1;l=l-1)
			    	a[i+1][l]=a[i+1][l-1];
			    a[i+1][0]=48;
			    for(l=j;l>=0;l=l-1)
				{
			    	if(a[i][l]>=a[i+1][l])a[i][l]=a[i][l]-a[i+1][l]+48;
			    	else 
					{
				    	a[i][l]=a[i][l]+10-a[i+1][l]+48;
				    	a[i][l-1]=a[i][l-1]-1;
					}
				}
		    	if(a[i][0]==49)
				{
		        	if(a[i][1]!=48)
				    for(l=1;l<=j;l++)printf("%c",a[i][l]);
				    else
					{
				         for(l=1;a[i][l]==48;l++);
			    	    for(m=0;m<=j-l;m++)
						{
					        a[i][m]=a[i][m+l];
					        printf("%c",a[i][m]);
						}
					}
				}
		    	else
				{
					a[i+1][0]=49;
			    	for(l=1;l<=j;l++)
				        a[i+1][l]=48;
					for(l=j;l>=1;l=l-1)
					{
				        if(a[i+1][l]>=a[i][l])a[i+1][l]=a[i+1][l]-a[i][l]+48;
				        else 
						{
					        a[i+1][l]=a[i+1][l]+10-a[i][l]+48;
					        a[i+1][l-1]=a[i+1][l-1]-1;
						}
					}
					printf("-");
					for(l=0;a[i+1][l]!=48;l++);
					for(k=l+1;k<=j;k++)printf("%c",a[i+1][k]);
				}
			} 
			printf("\n");
		}
	}	
}
int main()
{
	char a[100][101],b[100][101],j[100][101],A[100][101],B[100][101];
	int ac,bc,i,k,c,j1,j2,sw,p,n,i2;
	scanf("%d", &n);
	for (i=0;i<n;i++)
	{
		scanf("%s%s", a[i],b[i]);
		ac=strlen(a[i]);
		bc=strlen(b[i]);
		if (ac>bc)
		{
			c=ac;
			for (i2=0;i2<ac-bc;i2++)
				B[i][i2]='0';
			B[i][i2]='\0';
			strcat(B[i], b[i]);
			strcpy(A[i],a[i]);
		}
		if (ac<bc)
		{
			c=bc;
			for (i2=0;i2<bc-ac;i2++)
				A[i][i2]='0';
			A[i][i2]='\0';
			strcat(A[i], a[i]);
			strcpy(B[i], b[i]);
		}
		if (ac==bc)
		{
			c=ac;
			strcpy(A[i],a[i]);
			strcpy(B[i],b[i]);
		}
		sw=0;
		for (i2=c-1,k=0;i2>=0;i2--,k++)
		{
			j1=A[i][i2]-'0';
			j2=B[i][i2]-'0';
			if (j1-sw-j2>=0)
			{
				j[i][k]=j1-sw-j2+'0';
				sw=0;
			}
			else
			{
				j[i][k]=10+j1-sw-j2+'0';
				sw=1;
			}
		}
		j[i][k]='\0';
		if (i!=n-1)
			printf("\n");
	}
	for (i2=0,p=0;i2<n;i2++)
	{
		c=strlen(j[i2]);
		for (i=c-1;j[i2][i]=='0';i--)
			p+=1;
		for (i=c-p-1;i>=0;i--)
		{
			printf("%c", j[i2][i]);
		}
		if (i2!=n-1)
				printf("\n");
	}
	return 0;
}