#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i = 0; i < a.size() - 1; ++i) {
    if (a[i] == '0' and b[i] == '0' and a[i + 1] == '0') {
      ++ans;
      a[i + 1] = 'X';
    } else if (a[i] == '0' and b[i] == '0' and b[i + 1] == '0') {
      ++ans;
      b[i + 1] = 'X';
    } else if ((a[i] == '0' or b[i] == '0') and a[i + 1] == '0' and
               b[i + 1] == '0') {
      ++ans;
      a[i + 1] = b[i + 1] = 'X';
    }
  }
  cout << ans << '\n';
  return 0;
}
