#include <bits/stdc++.h>
using namespace std;
string a, b;
int main() {
  cin >> a >> b;
  int counter = 0;
  int n = sizeof(a);
  for (int i = 0; i < a.size() - 1; i++) {
    if (a[i] == '0' && a[i + 1] == '0' && b[i] == '0') {
      a[i] = 'k';
      a[i + 1] = 'k';
      b[i] = 'k';
      counter++;
    }
    if (a[i] == '0' && a[i + 1] == '0' && b[i + 1] == '0') {
      a[i] = 'k';
      a[i + 1] = 'k';
      b[i + 1] = 'k';
      counter++;
    }
    if (a[i] == '0' && b[i + 1] == '0' && b[i] == '0') {
      a[i] = 'k';
      b[i + 1] = 'k';
      b[i] = 'k';
      counter++;
    }
    if (a[i + 1] == '0' && b[i + 1] == '0' && b[i] == '0') {
      a[i + 1] = 'k';
      b[i + 1] = 'k';
      b[i] = 'k';
      counter++;
    }
  }
  cout << counter << endl;
  return 0;
}
