#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ull = unsigned long long;   int t, n, m;   string x, y;   int main() {     cin >> t;     while (t--) {       cin >> x;       cin >> y;       n = (int)(x.length());       m = (int)(y.length());       reverse(x.begin(), x.end());       reverse(y.begin(), y.end());       int pos1 = 0;       while (y[pos1] !=  1 ) {         ++pos1;       }       int pos2 = pos1;       while (x[pos2] !=  1 ) {         ++pos2;       }       cout << pos2 - pos1 << endl;     }     return 0;   }   