#include<bits/stdc++.h>
using namespace std;
string a,b;
vector<int > x,y,z;
void sub(vector<int >t1,vector<int >t2){
int t=0;
for(int i=0;i<t1.size();i++){
if(i<t2.size()) t+=t2[i];
if(t1[i]>=t){
z.push_back(t1[i]-t);
t=0;
}else{
z.push_back(t1[i]+10-t);
t=1;
}
}
}
int main(){
cin>>a;
cin>>b;
int flag=1;
for(int i=a.size()-1;i>=0;i--)
x.push_back(a[i]-'0');
for(int i=b.size()-1;i>=0;i--)
y.push_back(b[i]-'0');
if(a.size()>b.size()){
sub(x,y);
}else if (a.size()<b.size()){
sub(y,x);
flag=0;
}else{
flag=-1;
for(int i=0;i<a.size();i++){
if(a[i]>b[i]){
sub(x,y);
flag=1;
break;
}else if(a[i]<b[i]){
sub(y,x);
flag=0;
break;
}
}
}
if(flag==-1) cout<<"0";
else{
if(flag==0) cout<<"-";
bool fg=0;
for(int i=z.size()-1;i>=0;i--){
if(!fg&&z[i]!=0) fg=1;
if(fg) cout<<z[i];
}
}
return 0;
}
|