#include <bits/stdc++.h>
using namespace std;
int n;
const int SUCK = -999;
char board[2][222];
int dp[222][5];
const int prv[4] = {1, 2, 3, 3};
const int cur[4] = {3, 3, 1, 2};
bool checkEnding(int pos, int freeState) {
  for (int i = 0; i < 2; i++) {
    int vd = freeState & (1 << i);
    if (vd)
      if (board[i][pos] == 'X') return false;
  }
  return true;
}
int canplace(int pos, int tm) {
  int ret = 0;
  for (int i = 0; i < 2; i++) {
    int vd = tm & (1 << i);
    if (vd) {
      if (board[i][pos] == 'X') return -1;
    }
    if (vd == 0 && board[i][pos] == '0') ret += (1 << i);
  }
  return ret;
}
bool checkprv(int prvfree, int req) {
  for (int i = 0; i < 2; i++) {
    int vd = req & (1 << i);
    int pr = prvfree & (1 << i);
    if (vd) {
      if (pr == 0) return false;
    }
  }
  return true;
}
int main() {
  scanf("%s", board[0]);
  scanf("%s", board[1]);
  n = strlen(board[0]);
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < 4; i++) dp[0][i] = SUCK;
  for (int i = 0; i < 4; i++)
    if (checkEnding(0, i)) dp[0][i] = 0;
  for (int i = 1; i < n; i++) {
    for (int mask = 0; mask < 4; mask++) {
      dp[i][mask] = SUCK;
      if (checkEnding(i, mask)) {
        for (int om = 0; om < 4; om++)
          dp[i][mask] = max(dp[i][mask], dp[i - 1][om]);
      }
    }
    for (int p = 0; p < 4; p++) {
      int newState = canplace(i, cur[p]);
      if (newState == -1) continue;
      for (int om = 0; om < 4; om++) {
        if (!checkprv(om, prv[p])) continue;
        dp[i][newState] = max(dp[i][newState], dp[i - 1][om] + 1);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 4; i++) ans = max(ans, dp[n - 1][i]);
  printf("%d\n", ans);
  return 0;
}
