#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
const int INF = 1e9;
const long long MAX = 1e5 + 10, N = 1e7 + 10;
const int lim = 1 << 18;
int main() {
  ios_base::sync_with_stdio(0);
  string s1, s2;
  while (cin >> s1 >> s2) {
    int n = s1.length();
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (i + 2 < n && s1[i] == '0' && s1[i + 1] == '0' && s1[i + 2] == '0' &&
          s2[i] == '0' && s2[i + 1] == '0' && s2[i + 2] == '0')
        ans += 2, i += 2;
      else if (i + 1 < n) {
        if (s1[i] == '0' && s1[i + 1] == '0' &&
            (s2[i] == '0' || s2[i + 1] == '0'))
          ans++, i++;
        else if (s2[i] == '0' && s2[i + 1] == '0' &&
                 (s1[i] == '0' || s1[i + 1] == '0'))
          ans++, i++;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
