#include <bits/stdc++.h>
using namespace std;
template <typename T>
void write(vector<T> &a) {
  for (auto it = a.begin(); it != a.end(); it++) cout << *it << " ";
  cout << "\n";
}
void random(long long int nMin, long long int nMax, long long int n) {
  srand(time(0));
  for (long long int i = 0; i < n; i++) {
    double var =
        nMin + (long long int)((double)rand() / ((double)RAND_MAX + 1) *
                               (nMax - nMin + 1));
    cout << var << " ";
  }
  cout << "\n";
}
char o, x;
void check(vector<string> &a, long long int i, long long int &count) {
  if (a[1][i] == o) {
    if (a[0][i] == o && a[0][i + 1] == o) {
      a[1][i] = a[0][i] = a[0][i + 1] = x;
      count++;
    } else if (a[1][i + 1] == o && a[0][i + 1] == o) {
      a[1][i] = a[0][i + 1] = a[1][i + 1] = x;
      count++;
    }
  }
  if (a[0][i] == o) {
    if (a[0][i + 1] == o && a[1][i + 1] == o) {
      a[0][i] = a[0][i + 1] = a[1][i + 1] = x;
      count++;
    } else if (a[1][i] == o && a[1][i + 1] == o) {
      a[0][i] = a[1][i] = a[1][i + 1] = x;
      count++;
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(15);
  {
    vector<string> a(2);
    cin >> a[0] >> a[1];
    long long int count = 0;
    o = '0', x = 'X';
    long long int n = a[0].length();
    for (long long int i = 0; i < n - 1; i++) {
      if (a[0][i] == o || a[1][i] == o) check(a, i, count);
    }
    cout << count << "\n";
  }
  return 0;
}
