#include <bits/stdc++.h>
long long mod(long long x) {
  if (x < 0) return -x;
  return x;
}
long long expo(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y % 2 == 1) res = (res * x);
    y >> 1;
    x = x * x;
  }
  return res;
}
using namespace std;
vector<long long> v;
long long a[1000000], b[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  long long n, t, x = 0, y = 0;
  string s[2];
  cin >> s[0];
  cin >> s[1];
  for (int i = 0; i < s[0].length(); ++i) {
    if (s[0][i] == '0' && s[0][i + 1] == '0') {
      if (s[1][i] == '0') {
        s[0][i] = 'X';
        s[0][i + 1] = 'X';
        s[1][i] = 'X';
        y++;
      }
    }
    if (s[0][i] == '0' && s[0][i + 1] == '0') {
      if (s[1][i + 1] == '0') {
        s[0][i] = 'X';
        s[0][i + 1] = 'X';
        s[1][i + 1] = 'X';
        y++;
      }
    }
    if (s[0][i] == '0') {
      if (s[1][i] == '0' && s[1][i + 1] == '0') {
        s[0][i] = 'X';
        s[1][i] = 'X';
        s[1][i + 1] = 'X';
        y++;
      }
    }
    if (s[0][i] == '0') {
      if (s[1][i] == '0' && s[1][i - 1] == '0') {
        s[0][i] = 'X';
        s[1][i] = 'X';
        s[1][i - 1] = 'X';
        y++;
      }
    }
    if (s[1][i] == '0' && s[1][i + 1] == '0') {
      if (s[0][i] == '0') {
        s[1][i] = 'X';
        s[1][i + 1] = 'X';
        s[0][i] = 'X';
        y++;
      }
    }
    if (s[1][i] == '0' && s[1][i + 1] == '0') {
      if (s[0][i + 1] == '0') {
        s[1][i] = 'X';
        s[1][i + 1] = 'X';
        s[0][i + 1] = 'X';
        y++;
      }
    }
    if (s[1][i] == '0') {
      if (s[0][i] == '0' && s[0][i + 1] == '0') {
        s[0][i] = 'X';
        s[0][i + 1] = 'X';
        s[1][i] = 'X';
        y++;
      }
    }
    if (s[1][i] == '0') {
      if (s[0][i] == '0' && s[0][i - 1] == '0') {
        s[0][i] = 'X';
        s[0][i - 1] = 'X';
        s[1][i] = 'X';
        y++;
      }
    }
  }
  cout << y << endl;
  ;
  return 0;
}
