#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 5;
char str[maxn];
int dat[maxn], dp[maxn];
int use[maxn];
int main() {
  scanf("%s", str + 1);
  int len = strlen(str + 1);
  for (int i = 1; i <= len; i++)
    if (str[i] == '0') dat[i]++;
  scanf("%s", str + 1);
  for (int i = 1; i <= len; i++)
    if (str[i] == '0') dat[i]++;
  dp[1] = 0;
  dp[2] = dat[1] + dat[2] >= 3 ? 1 : 0;
  use[2] = dp[2] ? (dat[1] == 2 ? 1 : 2) : 0;
  for (int i = 3; i <= len; i++) {
    if (dp[i - 1] > dp[i - 2]) {
      if (dat[i] == 2 && dat[i - 1] - use[i - 1] > 0) {
        dp[i] = dp[i - 1] + 1;
        use[i] = 2;
      } else {
        dp[i] = dp[i - 1];
        use[i] = 0;
      }
    } else {
      dp[i] = dat[i] + dat[i - 1] >= 3 ? dp[i - 1] + 1 : dp[i - 1];
      if (dp[i] == dp[i - 1])
        use[i] = 0;
      else
        use[i] = dat[i - 1] == 2 ? 1 : 2;
    }
  }
  cout << dp[len] << endl;
}
