#include <bits/stdc++.h>
using namespace std;
string s1, s2;
long long dp[105][105] = {};
long long n;
long long solve(long long i, long long j) {
  if (i >= n || j >= n) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  long long y = 0;
  long long maxi = max(i, j);
  if (s1[maxi] == 'X' and s2[maxi] == '0')
    y = solve(maxi + 1, maxi);
  else if (s1[maxi] == '0' and s2[maxi] == 'X')
    y = solve(maxi, maxi + 1);
  else if (s1[maxi] == 'X' and s2[maxi] == 'X')
    y = solve(maxi + 1, maxi + 1);
  else {
    if (i == j) {
      if (i + 1 >= n)
        return 0;
      else if (s1[i + 1] == '0' and s2[j + 1] == '0')
        y = 1 + max({solve(i + 2, j + 1), solve(i + 2, j + 2),
                     solve(i + 1, j + 2)});
      else if (s1[i + 1] == 'X' and s2[j + 1] == 'X')
        y = solve(i + 2, j + 2);
      else
        y = 1 + solve(i + 2, j + 2);
    } else if (i == j - 1) {
      if (s1[i + 1] == '0')
        y = 1 + solve(i + 2, j + 1);
      else
        y = solve(i + 2, j + 1);
    } else if (j == i - 1) {
      if (s2[j + 1] == '0')
        y = 1 + solve(i + 1, j + 2);
      else
        y = solve(i + 1, j + 2);
    }
    return dp[i][j] = y;
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> s1 >> s2;
  n = s1.length();
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 0);
}
