fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define pii pair<int, int>
  6. #define vi vector<int>
  7. #define vvi vector<vector<int>>
  8. #define all(x) (x).begin(), (x).end()
  9.  
  10. void fastIO() {
  11. ios::sync_with_stdio(false);
  12. cin.tie(nullptr);
  13. cout.tie(nullptr);
  14. }
  15.  
  16. #ifdef LOCAL
  17. #define debug(x) cerr << #x << " = " << x << endl
  18. #else
  19. #define debug(x)
  20. #endif
  21.  
  22. const int MOD = 1e9 + 7;
  23.  
  24.  
  25. void solve() {
  26. string l, r;
  27. cin >> l >> r;
  28. int k = 0;
  29. while (k < l.size() && l[k] == r[k]) k++;
  30. cout << 2 * k << '\n';
  31. }
  32.  
  33. int32_t main() {
  34. fastIO();
  35. int t = 1;
  36. cin >> t;
  37. while (t--) solve();
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
0