#include <bits/stdc++.h>
using namespace std;
string s[2];
long long dp[105][4], ans[105];
vector<long long> vec;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s[0] >> s[1];
  if (s[0].size() == 1) return cout << 0, 0;
  for (long long i = 0; i < 2; ++i) {
    for (long long j = 0; j < 2; ++j) {
      if (s[i][j] == 'X') vec.push_back(i * 2 + ((i == 0 ? 0 : 1) ^ j));
    }
  }
  if (vec.size() == 1)
    dp[1][vec[0]] = 1, ans[1] = 1;
  else if (vec.size() == 0) {
    for (long long i = 0; i < 4; ++i) dp[1][i] = 1;
    ans[1] = 1;
  }
  for (long long i = 2; i < s[0].size(); ++i) {
    vec.clear();
    for (long long j = 0; j < 2; ++j) {
      for (long long k = i - 1; k <= i; ++k) {
        if (s[j][k] == 'X')
          vec.push_back(j * 2 + ((j == 0 ? 0 : 1) ^ (k - (i - 1))));
      }
    }
    ans[i] = ans[i - 1];
    if (vec.size() > 1) continue;
    for (long long j = 0; j < 4; ++j) {
      if (vec.size() == 0 || vec[0] == j) {
        dp[i][j] = max(dp[i][j], ans[i - 2] + 1);
        if (j == 0 || j == 3)
          dp[i][j] = max(dp[i][j], dp[i - 1][(j + 2) % 4] + 1);
        ans[i] = max(ans[i], dp[i][j]);
      }
    }
  }
  cout << ans[s[0].size() - 1];
  return 0;
}
