#include <bits/stdc++.h>
using namespace std;
long long n;
vector<vector<bool> > star;
long long ans = 0;
void get1(long long ind) {
  long long cnt = 0;
  for (long long i = 0; i < 2; i++) {
    for (long long h = 0; h < 2; h++) cnt += (long long)star[ind - i][h];
  }
  if (cnt == 1) {
    ++ans;
    for (long long i = 0; i < 2; i++) {
      for (long long h = 0; h < 2; h++) star[ind - i][h] = true;
    }
  }
}
void get2(long long ind) {
  for (long long i = 0; i < 3; i++) {
    for (long long h = 0; h < 2; h++)
      if (star[ind - i][h]) return;
  }
  ans += 2;
  for (long long i = 0; i < 3; i++) {
    for (long long h = 0; h < 2; h++) star[ind - i][h] = true;
  }
}
void get3(long long ind) {
  for (long long i = 0; i < 2; i++) {
    for (long long h = 0; h < 2; h++)
      if (star[ind - i][h]) return;
  }
  ans++;
  star[ind - 1][0] = star[ind - 1][1] = star[ind][0] = true;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<string> val(2);
  cin >> val[0] >> val[1];
  n = val[0].size();
  star.resize(n, vector<bool>(2, false));
  for (long long i = 0; i < n; i++) {
    for (long long h = 0; h < 2; h++) {
      char vr = val[h][i];
      if (vr != '0') star[i][h] = true;
    }
  }
  for (long long i = 1; i < n; i++) {
    get1(i);
    if (i != n - 1) get2(i + 1);
    get3(i);
  }
  cout << ans << endl;
}
