#include <bits/stdc++.h>
using namespace std;
char c[2][5050];
int n;
string s[2];
int ans = 0;
int main() {
  cin >> s[0] >> s[1];
  n = s[0].size();
  for (int i = 0; i <= 1; i++)
    for (int r = 0; r < s[0].size(); r++) c[i][r + 1] = s[i][r];
  c[0][0] = c[1][0] = c[0][n + 1] = c[1][n + 1] = 'X';
  for (int i = 1; i <= n; i++) {
    if ((c[0][i] == c[1][i]) && c[0][i] == '0') {
      if (c[0][i - 1] == '0') {
        ans++;
        c[0][i] = c[1][i] = c[0][i - 1] = 'X';
      } else if (c[1][i - 1] == '0') {
        ans++;
        c[0][i] = c[1][i] = c[1][i - 1] = 'X';
      } else if (c[0][i + 1] == '0') {
        ans++;
        c[0][i] = c[1][i] = c[0][i + 1] = 'X';
      } else if (c[1][i + 1] == '0') {
        ans++;
        c[0][i] = c[1][i] = c[1][i + 1] = 'X';
      }
    }
  }
  cout << ans;
}
