#include<iostream> #include<string> #include<string.h> #include<stack> #include<queue> #include<map> #include<set> #define ll long long using namespace std; const int N = 1e6 + 10; ll gcd(ll x, ll y) { return x % y == 0 ? y : gcd(y, x%y); } struct node { ll val; node* next; }; int main() { int t; cin >> t; while (t--) { string s, a, b = ""; cin >> s; cin >> a; int len = s.length(); //计算字符串s减去字符串a int len1 = a.length(); int i = 0, j = 0, flag = 0; while (i < len&&j < len1) { s[i] = s[i] - flag; if (s[i] >= a[j]) { flag = 0; char temp = s[i] - a[j] + '0'; b = b + temp; } else { flag = 1; char temp = 10 + s[i] - a[j] + '0'; b = b + temp; } i++, j++; } while (i < len) { if (flag == 0) b = b + s[i]; else { char temp = s[i] - 1; b = b + temp; } i++; } cout << b << endl; } system("pause"); return 0; }