#include <bits/stdc++.h>
using namespace std;
string s[2];
int n;
int dp[111][10];
int gt_msk(int idx) { return ((s[0][idx] != '0') << 1) + (s[1][idx] != '0'); }
int is_possible(int msk1, int msk2) {
  if (msk1 == 0) return msk2 < 3;
  if (msk1 == 1) return msk2 == 0;
  if (msk1 == 2) return msk2 == 0;
  return 0;
}
int f(int idx, int msk) {
  if (idx == n) return 0;
  if (dp[idx][msk] != -1) return dp[idx][msk];
  int tmp = gt_msk(idx);
  int ans = f(idx + 1, tmp);
  if (is_possible(msk, tmp)) {
    if (tmp == 1)
      ans = max(ans, f(idx + 1, 3) + 1);
    else if (tmp == 2)
      ans = max(ans, f(idx + 1, 3) + 1);
    else if (tmp == 0)
      if (msk == 0)
        ans =
            max(ans, 1 + max(f(idx + 1, 3), max(f(idx + 1, 1), f(idx + 1, 2))));
      else
        ans = max(ans, 1 + f(idx + 1, 3));
    else
      assert(0);
  }
  return dp[idx][msk] = ans;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> s[0] >> s[1];
  n = s[0].size();
  cout << f(1, gt_msk(0));
  return 0;
}
