#include <bits/stdc++.h>
using namespace std;
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
  uniform_int_distribution<int> uid(0, lim - 1);
  return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
vector<int> g[N];
int a[N];
void solve() {
  long long i, j, n, k, data, m, f = 1;
  string s, t;
  cin >> s >> t;
  n = t.size();
  m = s.size();
  vector<int> visit(n + 1, 0);
  long long yay = 0, w = 0;
  vector<int> av(200, 0);
  for (i = 0; i < n; i++) {
    data = t[i];
    av[data]++;
  }
  for (i = 0; i < m; i++) {
    int x = s[i];
    if (av[x] > 0) {
      yay++;
      av[x]--;
      visit[i] = 1;
    }
  }
  for (i = 0; i < m; i++) {
    int x = s[i];
    if (x >= 65 && x <= 90 && visit[i] == 0) {
      if (av[x + 32] > 0) {
        av[x + 32]--;
        w++;
        visit[i] = 1;
      }
    } else if (x >= 97 && x <= 122 && visit[i] == 0) {
      if (av[x - 32] > 0) {
        av[x - 32]--;
        w++;
      }
      visit[i] = 1;
    }
  }
  cout << yay << " " << w;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long)result * base) % mod;
    base = ((long long)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
void ipgraph(int n, int m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
}
void dfs(int u, int par) {
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
  }
}
