fork(1) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t;
  6. cin >> t;
  7.  
  8. while (t > 0)
  9. {
  10. string a, b;
  11.  
  12. cin >> a >> b;
  13. int count = 0;
  14.  
  15. for (int i = 0; i < a.length(); i++)
  16. {
  17. if (a[i] == b[i])
  18. {
  19. continue;
  20. }
  21. ++count;
  22. for (int j = i; j < b.length()&&a[j]!=b[j]; j = j + 2)
  23. {
  24.  
  25.  
  26. a[j] = b[j];
  27.  
  28.  
  29. }
  30. }
  31. cout << count << endl;
  32.  
  33.  
  34.  
  35.  
  36. --t;
  37.  
  38. }
  39.  
  40.  
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0s 4184KB
stdin
3
100001
110111
1010
1010
000
111
stdout
2
0
2