#include <bits/stdc++.h>
using namespace std;
void debug() { cout << endl; }
template <typename T, typename... Args>
void debug(T a, Args... args) {
  cout << a << ' ';
  debug(args...);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  map<char, int> cnt;
  for (auto &x : t) cnt[x]++;
  int a = 0, b = 0;
  for (auto &x : s) {
    if (cnt.count(x)) {
      if (!--cnt[x]) cnt.erase(x);
      x = '#';
      a++;
    }
  }
  for (auto &x : s) {
    if (!cnt.count(x)) {
      if (isupper(x))
        x = tolower(x);
      else
        x = toupper(x);
      if (cnt.count(x)) {
        if (!--cnt[x]) cnt.erase(x);
        x = '#';
        b++;
      }
    }
  }
  cout << a << " " << b << '\n';
}
