#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i = 0; i < (int)a.size() - 1; i++) {
    bool ok = 0;
    if (i + 2 < (int)a.size()) {
      for (int j = 0; j < 3; j++) {
        if (a[i + j] == '0' && b[i + j] == '0') {
          ok = 1;
        } else {
          ok = 0;
          break;
        }
      }
    }
    if (ok) {
      ans += 2;
      for (int j = 0; j < 3; j++) {
        a[i + j] = 'X', b[i + j] = 'X';
      }
    }
    if (a[i] == '0' && b[i] == '0' && (a[i + 1] == '0' || b[i + 1] == '0')) {
      ans++;
      a[i] = b[i] = a[i + 1] = b[i + 1] = 'X';
    }
    if ((a[i] == '0' || b[i] == '0') && (a[i + 1] == '0' && b[i + 1] == '0')) {
      ans++;
      a[i] = b[i] = a[i + 1] = b[i + 1] = 'X';
    }
  }
  cout << ans << endl;
  return 0;
}
