#include <bits/stdc++.h>
using namespace std;
long long n;
long long v, p, k;
void solve() {
  string A, B;
  cin >> A >> B;
  n = A.length();
  int ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    if (A[i] == '0' && B[i] == '0' && A[i + 1] == '0') {
      ans++;
      if (i + 2 < n)
        if (B[i + 1] == '0' && B[i + 2] == '0' && A[i + 2] == '0') {
          ans++;
          i++;
        }
      i++;
    } else if (A[i] == '0' && B[i] == '0' && B[i + 1] == '0') {
      ans++;
      if (i + 2 < n)
        if (A[i + 1] == '0' && B[i + 2] == '0' && A[i + 2] == '0') {
          ans++;
          i++;
        }
      i++;
    } else if (A[i + 1] == '0' && B[i + 1] == '0' && A[i] == '0') {
      ans++;
      i++;
    } else if (A[i + 1] == '0' && B[i + 1] == '0' && B[i] == '0') {
      ans++;
      i++;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  for (long long a = 0; a < t; a++) {
    solve();
  }
  return 0;
}
