#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int l = s1.length();
  int count = 0;
  for (int i = 0; i < (l - 1); i++) {
    if (s1[i] == '0' && s1[i + 1] == '0' && s2[i] == '0') {
      count++;
      s1[i] = 'X';
      s1[i + 1] = 'X';
      s2[i] = 'X';
    }
    if (s1[i] == '0' && s1[i + 1] == '0' && s2[i + 1] == '0') {
      count++;
      s1[i] = 'X';
      s1[i + 1] = 'X';
      s2[i + 1] = 'X';
    }
    if (s2[i] == '0' && s2[i + 1] == '0' && s1[i] == '0') {
      count++;
      s2[i] = 'X';
      s2[i + 1] = 'X';
      s1[i] = 'X';
    }
    if (s2[i] == '0' && s2[i + 1] == '0' && s1[i + 1] == '0') {
      count++;
      s2[i] = 'X';
      s2[i + 1] = 'X';
      s1[i + 1] = 'X';
    }
  }
  cout << count;
}
