semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
char c[100];
void putcc(char a[],char b[])
{
	int A,B,i;
	A=strlen(a);
	B=strlen(b);
    for(i=B-1;i>=0;i--)
	{
		if(b[i]<=a[i-B+A]) c[i-B+A]=a[i-B+A]-b[i]+48;
		else
		{
			c[i-B+A]=a[i-B+A]+10-b[i]+48;
			a[i-B+A-1]=a[i-B+A-1]-1;
		}
	}
	for(i=A-B-1;i>=0;i--)
	{
		c[i]=a[i];
	}
}
int main()
{
	int n,i,l,A;
	char d[100][100];
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{	
		char a[100],b[100];
	    scanf("%s",a);
		scanf("%s",b);
		if(i!=n-1) scanf("\n");
		A=strlen(a);
		putcc(a,b);
		for(l=0;l<A;l++)
		{
			d[i][l]=c[l];
		}
		d[i][l]='\0';
	}
	for(i=0;i<n;i++)
	{
		l=0;
		while(d[i][l]!='\0')
		{
			printf("%c",d[i][l]);
			l=l+1;
		}
		printf("\n");
	}
	return 0;
}
int main ( )
{
	int n, i, j, k, len[100];
	char number[100][101], exp;
	cin >> n;
	cin.get();
	for (i = 0;i < 2*n;i++)
	{
		if (i == 2*n-1 || i % 2 == 0)
			cin.getline(number[i],101);
		else 
		{
			cin.getline(number[i],101);
			cin.get();                 /*????*/
		}
	}
	for (i = 0;i < 2*n;i++)
	{
		for (j = 0,k = strlen(number[i])-1;j < k;j++,k--)/*??????????*/
		{
			exp = number[i][j];
			number[i][j] = number[i][k];
			number[i][k] = exp;
		}
		len[i] = strlen(number[i]);
	}
	for (i = 0;i < 2*n;i = i + 2)
	{
		for (j = 0;j < len[i + 1];j++)
		{
			if (number[i][j] < number[i + 1][j])
			{
				number[i][j] = number[i][j] + ':' - number[i + 1][j];
				number[i][j + 1] --;
			}
			else number[i][j] = number[i][j] - number[i + 1][j] + '0';
		}
		if (number[i][len[i]-1] == 0)
			number[i][len[i]-1] = '\0';
		len[i] = strlen(number[i]);
	}
	for (i = 0;i < 2*n;i = i + 2)     /*??????*/
	{
		for (j = len[i]-1;j >= 0;j--)
		{
			if (j == 0)
				cout << number[i][j] <<endl;
			else cout << number[i][j];
		}
	}
	return 0;
}
void minus(char p[110],char a[110])
{
	int m,n,i,j;
	m=strlen(p);
	n=strlen(a);
	for(i=n-1;i>=0;i--)
    {
		if(p[m-n+i]>=a[i]) p[m-n+i]=p[m-n+i]-a[i]+48;
		else
		{
			for(j=m-n+i-1;j>=0;j--)
			{
				if(p[j]==48) p[j]=57;
				else 
				{
					p[j]-=1;
					break;
				}
			}
			p[m-n+i]=p[m-n+i]-a[i]+58;
		}
	}
	for(i=0;i<m;i++) if(p[i]!=48)break;
	for(j=0;j<m-i;j++) p[j]=p[j+i];	
}

void main()
{
	int n,i;
	char pass[110],act[110],res[100][110];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",pass,act);
		minus(pass,act);
		strcpy(res[i],pass);
	}
	for(i=0;i<n;i++) printf("%s\n",res[i]);
}
void f(char a[300],char b[300])
{
	int n1[300]={0},n2[300]={0},n3[300]={0},i,t,k=0;
	//?????????
	t=strlen(a);
	for(i=0;i<t;i++)
		n1[300-t+i]=a[i]-48;
	t=strlen(b);
	for(i=0;i<t;i++)
		n2[300-t+i]=b[i]-48;
	//????????????
	for(i=0;i<300;i++)
		n3[i]=n1[i]-n2[i];
	for(i=299;i>=0;i--)
		if(n3[i]<0){n3[i]=n3[i]+10;n3[i-1]--;}
		//???????0??
		//?????0???
	for(i=0;i<299;i++)
	{
		if(n3[i]!=0&&k==0){printf("%d",n3[i]);k++;}
		else if(k==1) printf("%d",n3[i]);
	}
		printf("%d\n",n3[299]);
}
void main()
{
	char a[10][300],b[10][300];
	int n,i;
	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]);
}
/*
 * integer.cpp
 *
 *  Created on: 2010-12-25
 *      Author: ???
 *      Function: ?????
 */
int main()
{
	int n,len1,len2;//n??????????len1??a????len2??b???
	char a[100],b[100],t;//a??????b????
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		len1=strlen(a);
		len2=strlen(b);
		for(int j=0;j<len1-j;j++){//????a?????????a[0]????
			t=a[j];
			a[j]=a[len1-j-1];
			a[len1-j-1]=t;
		}
		for(int j=0;j<len2-j;j++){//???b?????????b[0]????
			t=b[j];
			b[j]=b[len2-j-1];
			b[len2-j-1]=t;
		}
		for(int j=0;j<len2;j++)//??????????a?
			if(a[j]>=b[j]) a[j]=a[j]-b[j]+'0';
			else {
				a[j+1]--;
				a[j]=a[j]+10-b[j]+'0';
			}
		if(a[len1-1]!='0') cout<<a[len1-1];//????a??????0????????0?????
		for(int j=len1-2;j>=0;j--)
			cout<<a[j];
		cout<<endl;//???
	}
}
void jian(char a[100],char b[100])
{
	int m,n,i,t=0;
	n=strlen(a);
	m=strlen(b);
	for (i=0;i<=m-1;i++)
	{
			if (a[n-i-1]>=b[m-i-1]+t)
			{
				a[n-i-1]=a[n-i-1]-b[m-i-1]-t+48;
				t=0;
			}
			else{
				a[n-i-1]=a[n-i-1]+10-b[m-i-1]+48-t;
				t=1;
			}
	}
	for (i=m;i<=n-1;i++)
	{
		if (a[n-i-1]>=t+48)
			{
				a[n-i-1]=a[n-i-1]-t;
			break;
			}
			else{
				a[n-i-1]=a[n-i-1]+10-t;
				t=1;
			}
	}
	for (i=0;i<=n-1;i++)
	{
		if(a[i]=='0')
		{
			a[i]=0;
		}
		else{break;}
	}
}

		 void main()
{
	int n,i,j;
	char a[100][100]={0},b[100][100]={0},c[10];
	scanf("%d",&n);
	gets(c);
	for (i=0;i<=n-1;i++)
	{
		gets(a[i]);
		gets(b[i]);
		gets(c);
		jian(a[i],b[i]);
	}
	for (i=0;i<=n-1;i++)
	{
		for(j=0;j<=99;j++)
		{
			if(a[i][j]!=0)
			{
				printf("%c",a[i][j]);
			}
		}
		printf("\n");
	}
	
}
void MINUS(char* a,char* b);
void main()
{
	char jian[50][200],beijian[50][200];
	int n;
	int i=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",beijian[i]);
		scanf("%s",jian[i]);
	}
	for(i=0;i<n;i++)
	{
		MINUS(beijian[i],jian[i]);
	}
}

void MINUS(char* a,char* btemp)
{
	int lena,lenb;
	int i,j;
	char b[200];
	int temp=0;
	char tt='0';
	lena=strlen(a);
	lenb=strlen(btemp);
	for(i=0;i<lena-lenb;i++)//??
		b[i]='0';
	for(j=i+1;i<200;i++){
		b[i]=btemp[i-lena+lenb];
		}
	for(i=lena-1;i>=0;i--)
	{
		if(a[i]-b[i]+temp>=0){a[i]=a[i]-b[i]+temp+48;
		temp=0;}
		else{
			a[i]=a[i]-b[i]+temp+48+10;
			temp=-1;
		}
	}
for(i=0;i<200;i++)
{	
	if(a[i]=='\0')break;
	if(a[i]!=tt){putchar(a[i]);
	tt='*';}

}
putchar('\n');
}
void func(char a[],char b[])
{
	int p=0,i=0,j=0;
	int lena=strlen(a),lenb=strlen(b);
	for(i=lena-1,j=lenb-1;j>=0;i--,j--)
	{
		if((a[i]-b[j]-p)>=0)
			{
				a[i]='0'+a[i]-b[j]-p;
				p=0;
		    }
		else
		   {
			   a[i]='0'+a[i]-b[j]-p+10;
			   p=1;
		   }
	}
	a[i]=a[i]-p;
	for(i=0;i<=lena-1;i++)
	{
		if(a[i]!=0)break;
	}
	for(j=i;j<=lena-1;j++)
		cout<<a[j];
	cout<<endl;
	return ;
}

	    
int main()
{
	int n,i,j;
	cin >> n;
	for (i=1;i<=n;i++)
	{
		char a[101],b[101];
		cin >> a >> b;
		func(a,b);
	}
	return 0;
}
void main()
{
	int n,i,j,len1,len2;
	char a[1000],b[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",a,b);
		len1=strlen(a);
		len2=strlen(b);

		for(j=0;j<len2;j++)
		{
			if(a[len1-1-j]-b[len2-1-j]>=0)
				a[len1-1-j]=a[len1-1-j]-b[len2-1-j]+'0';

			else if(a[len1-1-j]-b[len2-1-j]<0)
			{
				a[len1-1-j]=a[len1-1-j]+10-b[len2-1-j]+'0';
				a[len1-2-j]=a[len1-2-j]-1;
			}
		}
		printf("%s\n",a);
	}
}
int main()
{
	void f(char x[100],char y[100]);
	char a[100][100],b[100][100];
	int n,i;
	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]);
	return 0;
}
void f(char x[100],char y[100])
{
	int m,n,i,j;
	char z[100],s[100];
	strcpy(z,x);
	m=strlen(x);
	n=strlen(y);
	for(i=1;i<=n;i++)
	{if(x[m-i]<y[n-i])
	{x[m-i]+=10;
	z[m-i-1]=x[m-i-1]-=1;}
	z[m-i]=x[m-i]-y[n-i]+48;
	}
	for(i=0;i<m;i++)
		if(z[i]!='0')
		{for(j=0;j<=m-i;j++)
		s[j]=z[i+j];
		break;}
	printf("%s\n",s);
}
void stringrev(char *a,char*b)
{	
	int i,j,k,l,n;
	l=strlen(a);
	for(i=0;i<l;i++)
	{
		b[i]=a[l-1-i];
	}
	b[i]=0;
}
void jianfa(char *a,char*b,char*c)
{	
	int i,j,k,l=strlen(a),t=0;
	char d[101]={0},e[101]={0};
	stringrev(a,d);
	stringrev(b,e);
	for(i=0;i<l;i++)
	{	
		if(e[i]!=0)
		d[i]=d[i]-e[i]-t;
		else
		d[i]=d[i]-'0'-t;
		if(d[i]<0)
		{	
			d[i]=d[i]+10+'0';
			t=1;
		}
		else
		{
			d[i]=d[i]+'0';
			t=0;
		}
	}
	for(j=l-1;j>=0;j--)
	{
		if(d[j]=='0')
			d[j]=0;
		else break;
	}
	stringrev(d,c);
}

void main()
{
	int n,i,j,k;
	char a[101],b[101],c[101]={0};
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s %s",a,b);
		jianfa(a,b,c);
		printf("%s\n",c);
	}
}
//   @ ?????.cpp
//   @ 1000012895
//   @ ???
//   @ 2010/11/17

int main()
{
	int n;
	cin >> n;
	char a[100], b[100];
	int inta[100], intb[100];
	int i, j, counta, countb, count0;
	for(i = 1; i <= n; i++)
	{
		cin >> a;
		cin >> b;
		for(counta = 0; a[counta] != '\0'; counta++)
			inta[counta] = a[counta] - '0';
		for(countb = 0; b[countb] != '\0'; countb++)
			intb[countb] = b[countb] - '0';
		for(j = counta - 1; j >= counta - countb; j--)
		{
			inta[j] = inta[j] - intb[j - counta + countb];
			if(inta[j] < 0)
			{
				inta[j] += 10;
				inta[j - 1]--;
			}
		}
		for(count0 = 0; inta[count0] == 0; count0++);
		for(j = count0; j < counta; j++)
			cout << inta[j];
		cout << endl;
		cin.get();
	}
	return 0;
}
int main()
{
  char a[201],b[201];
  int i,mark;
  int a1[201],b1[201],c1[201];
  int chang1,chang2,chang3;
  scanf("%d",&mark);
  while(mark--){
  scanf("%s%s",a,b);
  //???????
  memset(a1,0,sizeof(a1));
  memset(b1,0,sizeof(b1));
  memset(c1,0,sizeof(c1));
  chang1 = strlen(a);
  chang2 = strlen(b);
  for ( i = 0 ; i <chang1 ; i++)
    a1[i] = a[chang1 - 1 - i] - '0';
  for ( i = 0 ; i <chang2 ; i++)
    b1[i] = b[chang2 - 1 - i] - '0';
  chang3 = chang1;
  for ( i = 0 ; i < chang3 ; i++){
  c1[i] += a1[i]-b1[i];
  if (c1[i] < 0){
      c1[i+1]--;
      c1[i] += 10;
  }
}
  if (c1[chang3-1] == 0)
    chang3--;
  for ( i = chang3-1; i >= 0 ; i--)
    printf("%d",c1[i]);
  printf("\n");
  }
  return 0;
}
char str1[N],str2[N],temp[N];

int max(int x,int y)
{
	return(x>y?x:y);
}

void major(char *str1,char *str2)
{
	int a[N],b[N];
	int len1,len2,len,t,jump,i;
	len1=strlen(str1);
        len2=strlen(str2);
        if(len1<len2)
	{
        strcpy(temp,str1);t=len1;
        strcpy(str1,str2);len1=len2;
        strcpy(str2,temp);len2=t;
	}
	len=max(len1,len2);
	jump=len-len2+1;
	for(i=len;i>=0;i--)
		str1[i]=str1[i-1];
	str1[0]='0';
	for(i=len;i>=jump;i--)
	{
		str2[i]=str2[i-jump];
	}
	for(i=0;i<jump;i++)
		str2[i]='0';
	for(i=len;i>=0;i--)
	{
		a[i]=str1[i]-'0';
		b[i]=str2[i]-'0';
	}
	for(i=len;i>=0;i--)
	{
		if(a[i]>=b[i])
			a[i]=a[i]-b[i];
		else
		{
			a[i]=a[i]+10-b[i];
			a[i-1]-=1;
		}
	}
	if(a[1]==0)
	{
		for(i=0;i<=len-2;i++)
			temp[i]=a[i+2]+'0';
		temp[len-1]='\0';
	}
	else if(a[1]!=0)
	{
		for(i=0;i<=len-1;i++)
			temp[i]=a[i+1]+'0';
		temp[len]='\0';
	}
	printf("%s\n",temp);
}
void main()
{
	char s1[100][N],s2[100][N];
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s1[i]);
		scanf("%s",s2[i]);
		if(i<n-1)
			printf("\n");
	}
	printf("\n");
	for(i=0;i<n;i++)
		major(*(s1+i),*(s2+i));
}
int main()
{
	char num1[200],num2[200];
	int result[200];
	int n,i,j,k,flag=0;
	int len1,len2;

	cin>>n;
	
	for (i=1;i<=n;i++)
	{
		cin.get();
		cin.getline (num1,200);
		cin.getline (num2,200);
		
		len1=strlen(num1);
		len2=strlen(num2);

		
		for (j=len1-1,k=len2-1;j>=0;j--,k--)
		{
			if (k>=0)
			{
				if (flag==1)
				{	
					num1[j] -= 1;
					flag=0;
				}
				if (num1[j]<num2[k])
				{
					num1[j] += 10;
					flag=1;
				}
				result[j]=num1[j]-num2[k];
			}

			else 
			{
				if (flag==1)
				{
					num1[j] -=1;
					flag=0;
				}
				result[j]=num1[j]-'0';
			}
		}

		for (j=0;j<len1;j++)
		{	
			if (result[j]!=0)
				flag=1;
			if (result[j]==0 && flag==0)
				continue;
			else cout<<result[j];
		}
		cout<<endl;

		flag=0;
	}


	return 0;
}
void main()
{
	int n,i,j,t,k,p,lena,lenb;
	char a[101]={0};
	char b[101]={0};
	char c[101]={0};
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{	
		for(j=0;j<=100;j++)
		{
			a[j]=0;
			b[j]=0;
			c[j]=0;
		}
		scanf("%s",a);
		scanf("%s",b);
		lena=strlen(a);
		lenb=strlen(b);
		t=0;
		p=0;
		for(j=1;j<=lena;j++)
		{
			if(j>lenb)
			{	
			if(t==0)
				c[lena-j]=a[lena-j];
			else if(t==1)
				{	
				if(a[lena-j]=='0')
					{
						c[lena-j]='0'+9;
						t=1;
					}
				else 
					{
						c[lena-j]=a[lena-j]-1;
						t=0;
					}
				}
			}
			else
			{
				p=(a[lena-j]-'0')-t-(b[lenb-j]-'0');
				if(p>=0)
				{
				c[lena-j]=p+'0';
				t=0;
				}
				else 
				{
				t=1;
				c[lena-j]=p+10+'0';
				}
			}
		}
		k=0;
		for(j=0;j<=lena-1;j++)
		{
			if(c[j]!='0')
				k=1;
			if(k)
				printf("%c",c[j]);

		}
		printf("\n");
	}
}
main()
{
	int p;
	scanf("%d",&p);
	while(p>0)
	{
	char a[101],b[101],c[101]={0},a1[101]={0},b1[101]={0};int lena,lenb;
	int i,j;
	scanf("%s",a);
	scanf("%s",b);
	lena=strlen(a);
	lenb=strlen(b);
	
	for(i=0;i<lena;i++)
		a1[i+101-lena]=a[i];
	for(i=0;i<lenb;i++)
		b1[i+101-lenb]=b[i];

	int carry=0;
	for(j=100;j>=100-(lena-1);j--)
	{
		if (b1[j]==0) {c[j]=a1[j]-carry;carry=0;}
		else
		{
		if(a1[j]>b1[j]){
			c[j]=a1[j]-b1[j]-carry+'0';carry=0;}
		else
		{
			if (a1[j]==b1[j]&&carry==0) c[j]='0';
			else
			{
			c[j]=10+a1[j]-b1[j]-carry+'0';
			carry=1;
			}
		}}
		
	}
	int temp=0;

	for(i=0;i<101;i++)
	{
		if(c[i]!=0)
		{
			temp=i;break;
		}
	}

	for(i=temp;i<101;i++)
			printf("%c",c[i]);
	printf("\n");
	p--;
	}
}
int main()
{
	char C[1013];
	int A[1013],B[1013];
	int K1, K2, N;
	scanf("%d\n",&N);
	for (int I = 1; I <= N; I ++)
	{
		if (I > 1) scanf("\n");
		gets(C);K1 = strlen(C);
		for (int J = 0; J < K1; J ++) A[K1 - J] = C[J] - '0';
		gets(C);K2 = strlen(C);
		for (int J = 0; J < K2; J ++) B[K2 - J] = C[J] - '0';
		for (int J = 1; J <= K2; J ++) A[J] -= B[J];
		for (int J = 1; J <= K1; J ++)
			if (A[J] < 0)
			{
				A[J] += 10;
				A[J + 1] --;
			}
		for (int J = K1; J >= 1; J --) cout << A[J];
		cout << endl;
	}

}
main()
{
   char a[100],b[100],c[20][100];
   int n,i,j,j1,j2,lena,lenb;
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {
      scanf("%s",a);
	  scanf("%s",b);
	  lena=strlen(a);
	  lenb=strlen(b);
	  j=0;
	  for(j1=lena-1,j2=lenb-1;j2>=0;j1--,j2--)
	  {
		 if(j==1)  a[j1]=a[j1]-j;
                   j=0;
		 if(a[j1]<b[j2])
		 {
		   a[j1]=a[j1]+10-b[j2]+'0';
		   j=1;
		 }
		 else  a[j1]=a[j1]-b[j2]+'0';
	  }
	  if(j==1) a[j1]=a[j1]-j;
	  for(j1=0;j1<lena;j1++)
	  {
		  if(a[j1]!='0') break;
	  }
	  for(j=j1,j2=0;j<lena;j++,j2++)
	     c[i][j2]=a[j];
	  c[i][j2]='\0';
   }
   for(i=0;i<n;i++)
     printf("%s\n",c[i]);
   
}
int main ()
{
	int n;
	int i, j;
	char str1[101] , str2[101] ;
	int num1[101] = {0}, num2 [101] = {0};
	int l1, l2;
	int flag = 0;
	int k = 0;
	cin>> n;
	for (k = 1; k <= n; k++ )
	{
		cin >> str1;
		cin >> str2;
		l1 = strlen ( str1 ), l2 = strlen ( str2 );
		for ( i = 0; i < l1; i++ )
			num1[l1 - i - 1] = str1[i] - '0';

		for ( i = 0; i < l2; i++ )
			num2[l2 - i - 1] = str2[i] - '0';
		for ( i = 0; i < l1; i++ )
		{
			num1[i] = num1[i] - num2[i];
			j = i;
			while ( num1[j] < 0 )
			{
				num1[j]+=10, num1[j+1]--;
				j++;
			}
		}
		for ( i = l1 - 1; i >= 0 ; i-- )
		{
			if ( num1[i] == 0 && flag == 0 )
			{
				continue;
			}
			flag = 1;
			cout << num1[i];
		}
		cout << endl;
		for ( i = 0; i < l1; i++ )
			num1[i] = 0, str1[i] = 0;
		for ( i = 0; i < l2; i++ )
			num2[i] = 0, str2[i] = 0;
		flag = 0;
	}
	return 0;
}
int main()
{
	
	int n,n1;
	scanf("%d",&n);
	for(n1=0;n1<n;n1++)
	{
		char a[101]={"\0"};
		char b[101]={"\0"};            //????'\0'
		scanf("%s %s",a,b);
		int i;
		int lena=strlen(a),lenb=strlen(b);           //****?????????????strlen(a)???????????????????
        //?????strlen(a)????????......*******???????????????????~~~~~·
		for(i=99;i>=99-lena+1;i--)
		{
			a[i]=a[lena+i-100];
		}
		for(i=99-lena;i>=0;i--)
		{
			a[i]='0';
		}
		for(i=99;i>=99-lenb+1;i--)
		{
			b[i]=b[lenb+i-100];
		}
		for(i=99-lenb;i>=0;i--)
		{
			b[i]='0';
		}

		int c[100]={0};
		for(i=0;i<100;i++)
		{
			c[i]+=a[99-i]-b[99-i];
			if(c[i]<0)
			{
				c[i]=c[i]+10;
				c[i+1]--;
			}
		}
		int test=0;
		for(i=99;i>=0;i--)
		{
			if(c[i]==0&&test==0)continue;
			if(c[i]!=0&&test==0){printf("%d",c[i]);test++;continue;}
			if(test!=0){printf("%d",c[i]);continue;}
		}
		printf("\n");

		
		
	}

	return 0;
}
int main ()
{
	int l1,l2,i,b,n,j,m,jg[100];
	char a1[100],a2[100];
	scanf ("%d",&n);
	for (j=0;j<n;j++)
	{
		gets (a1);
		gets (a1);
	    gets (a2);
	    l1=strlen(a1);
	    l2=strlen(a2);
	
     	b=l1-l2;
    	for (i=l1-1;i>l1-l2-1;i--)
		{
		    if (a1[i]>a2[i-b] || a1[i]==a2[i-b])
			      jg[i]=a1[i]-a2[i-b];
		     else if (a1[i]<a2[i-b])
			 {
		    	jg[i]=a1[i]+10-a2[i-b];
		    	a1[i-1]=a1[i-1]-1;
			 }

		}

		for (i=0;i<l1-l2;i++)
			jg[i]=a1[i]-'0';

		for (i=0;i<l1;i++)
		{
			if (jg[i]==0)
				continue;
			else 
			{
				for (m=i;m<l1;m++)
				{
					printf ("%d",jg[m]);
					
				}
				break;
			}
		};
		printf("\n");
						
	}


	return 0;
}
// ??????????????
// ??
// 1000012768
// 2010.11.19
int main()
{
	char a[100], b[100];   //???????????
	int anum[100], bnum[100];
	int n, i, j, k, p;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a >> b;
		p = 0;
		int la = strlen(a);  //??????????????????
		int lb = strlen(b);
		for (j = la - 1; j >= 0; j--)
			anum[p++] = a[j] - '0';
		p = 0;
		for (j = lb - 1; j >= 0; j--)
			bnum[p++] = b[j] - '0';
		for (k = 0; k < lb; k++)
		{
			anum[k] = anum[k] - bnum[k];  //???????????0??????
			if (anum[k] < 0)
			{
				anum[k] += 10;
				anum[k + 1]--;
			}
		}
		for (k = la - 1; k >= 0; k--)
			cout << anum[k];   //????anum
		cout << endl;
	}
	return 0;
}
void main()
{
	int n,lena,lens,i,j,k;
	char str[100],a[100],*pa,*ps,e[20],*p;
	scanf("%d",&n);
	gets(e);
	for(i=1;i<=n;i++)
	{
		gets(str);
		gets(a);
		gets(e);
		lens=strlen(str);
		lena=strlen(a);
		pa=a+lena-1;
		ps=str+lens-1;
		for(;pa>=a;pa--,ps--)
		{
			if(*ps>=*pa)
				*ps=*ps-*pa+48;
			else
			{
				*ps=*ps-*pa+58;
				p=ps-1;
				while(*p==0)
				{
					*p=57;
					p--;
				}
				*p=*p-1;
			}
		}
		for(k=0;k<=lens-1;k++)
		{
			if(str[i]!=0)
				break;
		}
		for(j=k;j<lens-1;j++)
			printf("%c",str[j]);
		printf("%c\n",str[lens-1]);
	}
}
void main()
{
	int n;
	scanf("%d",&n);
	char a[100],b[100];
	int i;
	for(i=0;i<n;i++)
	{
	    scanf("%s %s",a,b);
		int ka=strlen(a);
		int kb=strlen(b);

		int aa[100]={0},bb[100]={0},c[100]={0};
		int j;
		for(j=0;j<ka;j++)
		{
			aa[j]=a[ka-1-j]-'0';
		}
		for(j=0;j<kb;j++)
		{
			bb[j]=b[kb-1-j]-'0';
		}
	
		for(j=0;j<ka;j++)
		{
			if(aa[j]>=bb[j])
			c[j]=aa[j]-bb[j];
			else
			{
				c[j]=aa[j]-bb[j]+10;
				aa[j+1]=aa[j+1]-1;
		}
			
		}
		if(c[ka-1]!=0)
			printf("%d",c[ka-1]);
		for(j=ka-2;j>=0;j--)
		{

			
			printf("%d",c[j]);
		}
		printf("\n");
	}

}
int main()
{
	int n,l1,l2, c[101],d[101];char a[101],b[101];                                       //????????????
	memset(a,0,sizeof(a));memset(b,0,sizeof(b));                                               //??????
	cin >> n;
	while(cin >> a >> b)                                                                           //?????
	{
		int i=0,j=0;
        memset(c,0,sizeof(c));memset(d,0,sizeof(d));
		l1=strlen(a);l2=strlen(b);                                                               //?????????????????
	    for(i=l1-1;i>=0;i--)
		     c[j++]=a[i]-'0';
	    j=0;
	    for(i=l2-1;i>=0;i--)
		     d[j++]=b[i]-'0';
	    for(i=0;i<100;i++)                                                                       //???
		{
	     	c[i+1]--;
	     	c[i]=c[i]+10;
		    c[i]=c[i]-d[i];
	    	if(c[i]>=10)
			{
		    	c[i]=c[i]-10;
	    		c[i+1]=c[i+1]+1;
			}
		}
    	i=100;
    	while(c[i]==0&&i>0)                                                                      //???
    		i--;
    	for(j=i;j>=0;j--)
	    	cout <<c[j];
    	cout << endl;
	};
	return 0;
}
//33453453553
//      34345


char str1[1000];
char str2[1000];
int num1[1000];
int num2[1000];
int main(){
	int n;
	cin>>n;
	getchar();
	while (n--){
	cin.getline(str1,999);
	cin.getline(str2,999);
	int len1=strlen(str1);
	int len2=strlen(str2);
	int i;
	for(i=0;i<len1;i++){
		num1[i]=str1[i]-'0';
	}
	for(i=0;i<len2;i++){
		num2[i]=str2[i]-'0';
	}
	int *p1=num1+len1-1;
	int *p2=num2+len2-1;
	for(i=0;i<len2;i++){
		*p1=*p1-*p2;
		if (*p1<0){
			*p1=*p1+10;
			*(p1-1)=*(p1-1)-1;
		}
		p1--;
		p2--;
	}

	int sum=0;
	for(i=0;i<len1;i++){
		sum=sum+num1[i];
	}
	if (sum==0){
		cout<<"0"<<endl;
		return 0;
	}
	int state=0;
	for(i=0;i<len1;i++){
		if ((state==0)&&(num1[i]!=0)){
				state++;
				cout<<num1[i];
				continue;
			}
		if (state==0){
			if (num1[i]==0) continue;
		}
		if (state==1){
			cout<<num1[i];
		}
	}
    cout<<endl;
	getchar();
	}
	return 0;
}
int main ()
{
	char bjs[100],js[100];
	int n,l1,l2,i,j,cha,c;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
			scanf("%s",bjs);
			scanf("%s",js);
		l1=strlen(bjs);
		l2=strlen(js);
        cha=l1-l2;
        for(j=(l2-1);j>=0;j--)
		{
			if (bjs[j+cha]<js[j])
			{
				bjs[j+cha]=bjs[j+cha]+10-js[j]+'0';
                c=1;
				bjs[j+cha-1]=bjs[j+cha-1]-c;
			}
			else
				bjs[j+cha]=bjs[j+cha]-js[j]+'0';
		}
		for(j=0;j<l1;j++)
		printf("%c",bjs[j]);
		printf("\n");
		printf("\n");
	}
}
main()
{
char str1[10][100],str2[10][100];
int a[10],b[10];
int i,j,k,n,t[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
     scanf("%s%s",str1[i],str2[i]);
  a[i]=strlen(str1[i]);b[i]=strlen(str2[i]);
}

for(i=0;i<n;i++)
{
        for(j=0;j<a[i];j++)
  {
   if(j<a[i]-b[i])t[j]=str1[i][j]-48;
            else t[j]=str1[i][j]-str2[i][j-a[i]+b[i]];
  }
  for(k=a[i]-1;k>=0;k--)
  {
   if(t[k]<0)
   {
    t[k-1]=t[k-1]-1;t[k]=t[k]+10;
   }
  }
  for(k=0;k<a[i];k++)
  {
   printf("%d",t[k]);
  }
  printf("\n");
}
}
int main()
{
	char num1[101],num2[101];
	int n;
	cin>>n;
	int i=0;
	for(;i<n;i++)
	{
		cin>>num1;
		cin>>num2;
		int len=strlen(num1);
		int j=strlen(num2);
		
		int k=len,q=j;
		for(;k>=len-j;k--,q--)
			num2[k]=num2[q];	
		

		for(k=0;k<len-j;k++)
			num2[k]='0';

		num1[len]=num2[len]=0;



		for(j=len-1;j>=0;j--)
		{
			if(num1[j]>=num2[j])
				num1[j]=num1[j]-num2[j]+48;
			else if(num1[j]>=num2[j] && num1[j-1]==0)
			{
				num1[j-1]=9;
				num1[j]=(10+num1[j]-num2[j]+48);
			}
			else 
			{
				num1[j]=(10+num1[j]-num2[j]+48);
				num1[j-1]--;
			}
		}
		cout<<num1<<endl;
	}
	
	return 0;
}
void main()
{
	int n,i,j,k,t;
	char a[100][100],b[100][100],c[100][100]={""};
	scanf("%d",&n);
		for(i=0;i<n;i++)
			{	scanf("%s%s",a[i],b[i]);/*?????????*/
printf("\n");
		}
		for(i=0;i<n;i++)
		{
			for(j=strlen(a[i])-1,k=strlen(b[i])-1;j>=(strlen(a[i])-strlen(b[i]));j--,k--)
			{
				if(a[i][j]>=b[i][k])
					c[i][j]=a[i][j]-b[i][k];
				else 
				{	a[i][j-1]=a[i][j-1]-1;
					c[i][j]=10+a[i][j]-b[i][k];
				}
				
				c[i][j]=c[i][j]+48;
			}
		for(t=strlen(a[i])-1;t>=0;t--)
		{if(a[i][t]<48)
		a[i][t-1]=a[i][t-1]-1;}
        for(t=0;t<strlen(a[i]);t++)
		if(a[i][t]<48)
			a[i][t]='9';
		for(j=0;j<strlen(a[i])-strlen(b[i]);j++)
			c[i][j]=a[i][j];
			c[i][strlen(a[i])]='\0';
			printf("%s\n",c[i]);
		}
}
int main()
{
    char s1[102],s2[100];
    int a,b,i,j,n,d;
    cin >> n;
    gets(s1);
    for(i=0;i<n;i++)
    {
        gets(s1);
        gets(s2);
        a=strlen(s1);
        b=strlen(s2);
        d=0;
        for(j=b-1;j>=0;j--)
        {
            d=s1[j-b+a]-s2[j]+d;
            if (d>=0) {
                s1[j-b+a]=d+'0';
                d=0;
            }
            else {
                s1[j-b+a]=d+'0'+10;
                d=-1;
            }

        }
        while(d==-1&&j-b+a>=0){
            d=s1[j-b+a]-1-'0';
            if (d>=0) {
                s1[j-b+a]=d+'0';
                break;
            }
            else {
                s1[j-b+a]='9';
                d=-1;
            }
            j--;
        }
        j=0;
        while(s1[j]=='0')j++;
        while(j<a)
        {
            cout<<s1[j];
            j++;
        }
        cout<<endl;
        gets(s1);
    }
}
void minus(char a[],char b[],char result[]);
void main()
{
	int n,i;
	char a[max][max],b[max][max];
    char result[max][max];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s\n%s\n\n",a[i],b[i]);
		minus(a[i],b[i],result[i]);       
        printf("%s\n",result[i]);
	}
}

void minus(char a[],char b[],char result[])
{ 
	int la,lb,t=0,s,c=0,i;
    char temp;
    la=strlen(a)-1;
    lb=strlen(b)-1;
    while(la >= 0)
	{
        if(lb < 0)
		{
			s=a[la--]-48;
		}
        else 
		{
			s=a[la--]-b[lb--];
		}
        result[t++]=s-c+48;
        if(result[t-1] < 48) 
		{
			result[t-1]+=10;
			c=1;
		}
        else c=0;
	}
	while(result[t] == 0) t--;
    while(result[t] == '0')
	{
		result[t]=0;t--;
	} 
	for(i=0;i <= t/2;i++)
	{
        temp=result[i];
        result[i]=result[t-i];
        result[t-i]=temp;
    }
}
int main() {
	int n,la,lb;
	char a[100],b[100];
	int a1[100],b1[100],c[100];
	cin>>n;
	while(n>0)
	{
		cin>>a>>b;
		la=strlen(a);
		lb=strlen(b);
		for(int i=la-1,j=1;i>=0;i--)
			a1[j++]=a[i]-'0';
		for(int i=lb-1,j=1;i>=0;i--)
					b1[j++]=b[i]-'0';
		for(int i=lb+1;i<=la;i++)
			b1[i]=0;
		int t=0;
		for(int i=1;i<=la;i++)
		{
			c[i]=a1[i]-b1[i]+t;
			if(c[i]<0)
			{
				c[i]=c[i]+10;
				t=-1;
			}
			else
				t=0;
		}
		for(int i=la;i>=1;i--)
			if(c[i]!=0)
			{
				la=i;
				break;
			}
		for(int i=la;i>=1;i--)
			cout<<c[i];
		cout<<endl;
		n--;
	}
		return 0;
}