#include <bits/stdc++.h>
using namespace std;
map<pair<string, string>, int> dp;
string s[2];
int n;
int ret = 0;
bool check1(int x) {
  if (s[0][x - 1] == '0' && s[1][x - 1] == '0' && s[0][x] == '0') {
    s[0][x - 1] = '1';
    s[1][x - 1] = '1';
    s[0][x] = '1';
    return true;
  }
  return false;
}
bool check2(int x) {
  if (s[0][x - 1] == '0' && s[0][x] == '0' && s[1][x] == '0') {
    s[0][x - 1] = '1';
    s[0][x] = '1';
    s[1][x] = '1';
    return true;
  }
  return false;
}
bool check3(int x) {
  if (s[1][x - 1] == '0' && s[0][x] == '0' && s[1][x] == '0') {
    s[1][x - 1] = '1';
    s[0][x] = '1';
    s[1][x] = '1';
    return true;
  }
  return false;
}
bool check4(int x) {
  if (s[0][x - 1] == '0' && s[1][x - 1] == '0' && s[1][x] == '0') {
    s[0][x - 1] = '1';
    s[1][x - 1] = '1';
    s[1][x] = '1';
    return true;
  }
  return false;
}
int DP(int curr) {
  int t = 0;
  if (curr == n)
    return 0;
  else {
    string x, y;
    x = s[0].substr(curr - 1);
    y = s[1].substr(curr - 1);
    if (dp.find({x, y}) != dp.end()) return dp[{x, y}];
    bool found = false;
    int i = curr;
    if (check1(curr)) {
      t = max(t, DP(i + 1) + 1);
      s[0][i - 1] = '0';
      s[1][i - 1] = '0';
      s[0][i] = '0';
      found = true;
    }
    if (check2(curr)) {
      t = max(t, DP(i + 1) + 1);
      s[0][i - 1] = '0';
      s[0][i] = '0';
      s[1][i] = '0';
      found = true;
    }
    if (check3(curr)) {
      t = max(t, DP(i + 1) + 1);
      s[1][i - 1] = '0';
      s[0][i] = '0';
      s[1][i] = '0';
      found = true;
    }
    if (check4(curr)) {
      t = max(t, DP(i + 1) + 1);
      s[0][i - 1] = '0';
      s[1][i - 1] = '0';
      s[1][i] = '0';
      found = true;
    }
    if (!found) t = max(t, DP(curr + 1));
    dp[{x, y}] = t;
    return t;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s[0] >> s[1];
  n = s[0].length();
  int t = DP(1);
  cout << t << "\n";
  return 0;
}
