#include <bits/stdc++.h>
using namespace std;
const int M = 105;
char ch[2][M];
int dp[M][4], mask[M], n, ans;
void in() { scanf("%s%s", ch[0] + 1, ch[1] + 1); }
void ac() {
  n = strlen(ch[0] + 1);
  for (int i = 1; i <= n; ++i)
    ch[0][i] == '0' ? (ch[1][i] == '0' ? mask[i] = 0 : mask[i] = 1)
                    : (ch[1][i] == '0' ? mask[i] = 2 : mask[i] = 3);
  for (int i = 1; i <= n; ++i) dp[i][mask[i]] = 1;
  dp[0][3] = 1;
  for (int i = 1, j; i <= n; ++i) {
    for (j = 0; j <= 3; ++j) dp[i][mask[i]] = max(dp[i][mask[i]], dp[i - 1][j]);
    if (!mask[i]) {
      for (j = 0; j <= 2; ++j) {
        if (dp[i - 1][j]) dp[i][3] = max(dp[i - 1][j] + 1, dp[i][3]);
      }
      if (dp[i - 1][0])
        for (j = 1; j <= 2; ++j) dp[i][j] = max(dp[i - 1][0] + 1, dp[i][j]);
    } else if ((mask[i] == 1 || mask[i] == 2) && dp[i - 1][0])
      dp[i][3] = max(dp[i][3], dp[i - 1][0] + 1);
  }
  for (int i = 0; i <= 3; ++i) ans = max(ans, dp[n][i]);
  printf("%d", ans - 1);
}
int main() {
  in();
  ac();
}
