#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int node = 11, res[200009];
map<string, int> pm;
map<pair<int, int>, bool> road;
int id(string k) {
  if (!pm[k]) pm[k] = node++;
  return pm[k];
}
vector<int> adj[200009];
int dfs(int nd) {
  if (adj[nd].size() == 0) return 1;
  int sub = 1;
  for (__typeof((adj[nd]).begin()) it = (adj[nd]).begin();
       it != (adj[nd]).end(); it++)
    sub += dfs(*it);
  return sub;
}
void add(int x, int y) {
  if (!road[{x, y}]) {
    cerr << x << "->" << y << endl;
    adj[x].push_back(y);
    road[{x, y}] = true;
  }
}
int bfs(int nd) {
  int sub = res[nd];
  for (__typeof((adj[nd]).begin()) it = (adj[nd]).begin();
       it != (adj[nd]).end(); it++)
    sub += bfs(*it);
  return sub;
}
int main() {
  string s;
  while (cin >> s) {
    string k, last;
    k = s[0] + s[1] + s[2];
    for (int i = 3; i < (int)s.size(); i++) {
      if (s[i] == s[2]) {
        if (last.size() == 0)
          add(s[0] - 'A', id(k));
        else
          add(id(last), id(k));
        last = k;
      }
      k += s[i];
    }
    res[id(last)]++;
  }
  int folder = 0, file = 0;
  for (char c = 'C'; c <= 'G'; c++)
    for (__typeof((adj[c - 'A']).begin()) it = (adj[c - 'A']).begin();
         it != (adj[c - 'A']).end(); it++) {
      umax(folder, dfs(*it));
      umax(file, bfs(*it));
    }
  printf("%d %d\n", folder - 1, file);
  return 0;
}
