#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string s, q;
  cin >> s >> q;
  int k = 0;
  for (int i = 0; i < s.length() - 1; i++) {
    if (s[i] == '0' && s[i + 1] == '0' && (q[i] == '0' || q[i + 1] == '0')) {
      s[i] = 'X';
      s[i + 1] = 'X';
      if (q[i] == '0')
        q[i] = 'X';
      else
        q[i + 1] = 'X';
      k++;
    } else if (q[i] == '0' && q[i + 1] == '0' &&
               (s[i] == '0' || s[i + 1] == '0')) {
      q[i] = 'X';
      q[i + 1] = 'X';
      if (s[i] == '0')
        s[i] = 'X';
      else
        s[i + 1] = 'X';
      k++;
    }
  }
  cout << k << endl;
  return 0;
}
