#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)(2e5 + 5);
const long long MOD = (long long)(1e9 + 7);
int t;
string str[2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  t = 1;
  while (t--) {
    cin >> str[0] >> str[1];
    int cur = 0;
    int emp = 0;
    int ans = 0;
    for (int i = 0; i < str[0].size(); i++) {
      cur = (str[0][i] == '0') + (str[1][i] == '0');
      emp += cur;
      if (emp >= 3) {
        ans++;
        emp -= 3;
      } else
        emp = cur;
    }
    cout << ans << "\n";
  }
  return 0;
}
