#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  string s, t;
  cin >> s >> t;
  map<char, int> mp;
  n = t.size();
  m = s.size();
  for (int i = 0; i < n; i++) {
    mp[t[i]]++;
  }
  int yay = 0, oop = 0;
  for (int i = 0; i < m; i++) {
    if (mp[s[i]] > 0) {
      mp[s[i]]--;
      yay++;
      s[i] = '?';
    }
  }
  for (int i = 0; i < m; i++) {
    if (s[i] != '?') {
      if (s[i] >= 'a' && s[i] <= 'z') {
        char up = s[i] & '_';
        if (mp[up] > 0) oop++, mp[up]--;
      } else {
        char lo = s[i] | ' ';
        if (mp[lo] > 0) oop++, mp[lo]--;
      }
    }
  }
  cout << yay << " " << oop << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
