#include <bits/stdc++.h>
int N;
char brd[2][200];
int dp[200][4], dpv[200];
const int INF = 1000000007;
int main() {
  scanf("%s", brd[0] + 1);
  scanf("%s", brd[1] + 1);
  N = strlen(brd[0] + 1);
  dp[0][0] = -INF;
  dp[0][1] = -INF;
  dp[0][2] = -INF;
  dp[0][3] = 0;
  dpv[0] = 0;
  for (int i = 1; i <= N; i++) {
    if (brd[0][i] == '0' && brd[1][i] == '0') {
      dp[i][0] = dpv[i - 1];
      dp[i][1] = 1 + dp[i - 1][0];
      dp[i][2] = 1 + dp[i - 1][0];
      dp[i][3] = 1 + std::max(dp[i - 1][1], dp[i - 1][2]);
    }
    if (brd[0][i] == '0' && brd[1][i] == 'X') {
      dp[i][0] = -INF;
      dp[i][1] = dpv[i - 1];
      dp[i][2] = -INF;
      dp[i][3] = std::max(dpv[i - 1], 1 + dp[i - 1][0]);
    }
    if (brd[0][i] == 'X' && brd[1][i] == '0') {
      dp[i][0] = -INF;
      dp[i][1] = -INF;
      dp[i][2] = dpv[i - 1];
      dp[i][3] = std::max(dpv[i - 1], 1 + dp[i - 1][0]);
    }
    if (brd[0][i] == 'X' && brd[1][i] == 'X') {
      dp[i][0] = -INF;
      dp[i][1] = -INF;
      dp[i][2] = -INF;
      dp[i][3] = dpv[i - 1];
    }
    dpv[i] = -INF;
    for (int j = 0; j < 4; j++) {
      dpv[i] = std::max(dpv[i], dp[i][j]);
    }
  }
  printf("%d\n", dpv[N]);
  return 0;
}
