#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
string up, dn;
vector<vector<vector<long long int>>> dp;
vector<long long int> waysUp = {3, 3, 1, 2};
vector<long long int> waysDn = {2, 1, 3, 3};
long long int getSubUp(long long int i) {
  string s = up.substr(i - 1, 2);
  long long int mask = 0;
  if (s[0] == 'X') mask |= (1 << 1);
  if (s[1] == 'X') mask |= (1 << 0);
  return mask;
}
long long int getSubDn(long long int i) {
  string s = dn.substr(i - 1, 2);
  long long int mask = 0;
  if (s[0] == 'X') mask |= (1 << 1);
  if (s[1] == 'X') mask |= (1 << 0);
  return mask;
}
void recalc_1(long long int i) {
  long long int maskUp = getSubUp(i);
  long long int maskDn = getSubDn(i);
  for (long long int b11 = 0; b11 < 2; b11++) {
    for (long long int b21 = 0; b21 < 2; b21++) {
      if ((up[i - 1] == '0' || (b11 == 1)) &&
          (dn[i - 1] == '0' || (b21 == 1))) {
        long long int nmaskUp = (b11 << 1) | maskUp;
        long long int nmaskDn = (b21 << 1) | maskDn;
        for (long long int b12 = 0; b12 < 2; b12++) {
          for (long long int b22 = 0; b22 < 2; b22++) {
            long long int updMaskUp = (b12 << 1) | b11;
            long long int updMaskDn = (b22 << 1) | b21;
            dp[i][nmaskUp][nmaskDn] =
                max(dp[i][nmaskUp][nmaskDn], dp[i - 1][updMaskUp][updMaskDn]);
          }
        }
      }
    }
  }
}
void recalc_2(long long int i) {
  long long int BaseMaskUp = getSubUp(i);
  long long int BaseMaskDn = getSubDn(i);
  for (long long int j = 0; j < 4; j++) {
    long long int wup = waysUp[j];
    long long int wdn = waysDn[j];
    if ((BaseMaskUp & wup) == 0 && (BaseMaskDn & wdn) == 0) {
      long long int maskUp = BaseMaskUp | wup;
      long long int maskDn = BaseMaskDn | wdn;
      for (long long int b11 = 0; b11 < 2; b11++) {
        for (long long int b21 = 0; b21 < 2; b21++) {
          if ((((BaseMaskUp >> 1) & 1) == 0 || (b11 == 1)) &&
              (((BaseMaskDn >> 1) & 1) == 0 || (b21 == 1)) &&
              (((wup >> 1) & 1) == 0 || b11 == 0) &&
              (((wdn >> 1) & 1) == 0 || b21 == 0)) {
            long long int nmaskUp = (b11 << 1) | maskUp;
            long long int nmaskDn = (b21 << 1) | maskDn;
            for (long long int b12 = 0; b12 < 2; b12++) {
              for (long long int b22 = 0; b22 < 2; b22++) {
                long long int updMaskUp = (b12 << 1) | b11;
                long long int updMaskDn = (b22 << 1) | b21;
                dp[i][nmaskUp][nmaskDn] =
                    max(dp[i][nmaskUp][nmaskDn],
                        dp[i - 1][updMaskUp][updMaskDn] + 1);
              }
            }
          }
        }
      }
    }
  }
}
signed main() {
  cin >> up >> dn;
  long long int n = up.size();
  if (n <= 1) {
    cout << 0 << "\n";
    return 0;
  }
  dp.resize(n,
            vector<vector<long long int>>(4, vector<long long int>(4, -1e15)));
  long long int baseMaskUp = getSubUp(1);
  long long int baseMaskDn = getSubDn(1);
  dp[1][baseMaskUp][baseMaskDn] = 0;
  for (long long int i = 0; i < 4; i++) {
    long long int wup = waysUp[i];
    long long int wdn = waysDn[i];
    if ((baseMaskUp & wup) == 0 && (baseMaskDn & wdn) == 0) {
      long long int maskUp = baseMaskUp | wup;
      long long int maskDn = baseMaskDn | wdn;
      dp[1][maskUp][maskDn] = 1;
    }
  }
  for (long long int i = 2; i < n; i++) {
    recalc_1(i);
    recalc_2(i);
  }
  long long int ans = 0;
  for (long long int mask1 = 0; mask1 < 4; mask1++) {
    for (long long int mask2 = 0; mask2 < 4; mask2++) {
      ans = max(ans, dp[n - 1][mask1][mask2]);
    }
  }
  cout << ans;
  return 0;
}
