#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using str = string;
int main() {
  ios::sync_with_stdio(0);
  str up, down;
  cin >> up >> down;
  int ans = 0;
  int empty = 0;
  for (int i = 0; up[i]; ++i) {
    int now = (up[i] == '0') + (down[i] == '0');
    empty += now;
    if (empty >= 3) {
      ++ans;
      empty -= 3;
    } else
      empty = now;
  }
  cout << ans;
}
