#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int cnt[110];
int main() {
  memset(cnt, 0, sizeof(cnt));
  cin >> s1 >> s2;
  int i, j, t, ans = 0, n = s1.size();
  for (i = 0, t = 0; i < n; i++) {
    if (s1[i] == '0' && s2[i] == '0') {
      cnt[i] = 2;
    } else if (s1[i] == '0' || s2[i] == '0')
      cnt[i] = 1;
  }
  for (i = 0; i < n; i++) {
    if (cnt[i] + cnt[i + 1] + cnt[i + 2] == 6) {
      ans += 2;
      i += 2;
    } else if (cnt[i] + cnt[i + 1] == 3 || cnt[i] + cnt[i + 1] == 4) {
      ans += 1;
      i++;
    }
  }
  ans += min(t / 3, j);
  cout << ans;
  return 0;
}
