#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  string s1, s2;
  cin >> s1 >> s2;
  int co = 0, did = 0;
  for (int i = 0; i < s1.size(); i++) {
    did = 0;
    if (s1[i] == '0' && s2[i] == '0') {
      if (i != 0) {
        if (s1[i - 1] == '0' || s2[i - 1] == '0') co++, did = 1;
      }
      if (did == 0 && i != s1.size() - 1) {
        if (s1[i + 1] == '0')
          co++, s1[i + 1] = 'X', did = 1;
        else if (s2[i + 1] == '0')
          co++, s2[i + 1] = 'X', did = 1;
      }
      if (did == 1) s1[i] = 'X', s2[i] = 'X';
    }
  }
  cout << co << endl;
}
