#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int max(int m,int n)
{
if(m>n)
return m;
return n;
}
int compare(char *str_a,char *str_b)
{
int len_a, len_b;
len_a = strlen(str_a); //分别获取大数的位数进行比较
len_b = strlen(str_b);
if ( strcmp(str_a, str_b) == 0 ) //返回比较结果
return 0;
if ( len_a > len_b )
return 1;
else if( len_a == len_b )
return strcmp(str_a, str_b);
else
return -1;
}
int main()
{
int f, n;
int i, k;
char str_a[1000], str_b[1000];
int num_a[1000] ; //初始化大数数组,各位全清0
int num_b[1000] ;
int num_c[1000];
while (scanf("%s%s",str_a,str_b)!= EOF) //可进行多组测试
{
memset(num_a,0,sizeof(num_a));
memset(num_b,0,sizeof(num_b));
int len_a = strlen(str_a); //分别获得两个大数的位数
int len_b = strlen(str_b);
k = max(len_a,len_b) ; //获得最大的位数;
num_c[0] = 0;
f = 0;
n = compare(str_a,str_b);
for (i=0;i<len_a;i++) //颠倒存储
num_a[i] = str_a[len_a-i-1] - '0';
for (i=0;i<len_b;i++)
num_b[i] = str_b[len_b-i-1] - '0';
for (i=0;i<k;i++) //逐位进行减法
{
if (n>=0)
{
if (num_a[i] >= num_b[i])
num_c[i] = num_a[i] - num_b[i];
else
{
num_c[i] = num_a[i] - num_b[i] + 10;
num_a[i+1]--;
}
}
else
{
if ( num_b[i] >= num_a[i])
num_c[i] = num_b[i] - num_a[i];
else
{
num_c[i] = num_b[i] - num_a[i] + 10;
num_b[i+1]--;
}
}
}
if (n<0) //按要求打印
printf("-");
for (i=k-1; i>=0; i--)
{
if (num_c[i])
f = 1;
if (f || i == 0 )
printf("%d",num_c[i]);
}
printf("\n");
}
return 0;
}