#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

struct item
{
	list <int> p;
};

stack <int> st;
int cur = 0;
int n;
bool used[10005];
item a[10005];
char c;
int md = 0, mb, cb;

void rec(int n, int g)
{
	if (g > md)
		md = g;

	for (list <int>::iterator it = a[n].p.begin(); it != a[n].p.end(); it++)
		rec(*it, g + 1);
}

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	st.push(0);

	while ((c = getchar()) != '\n')
	{
		cur = st.top();

		if (c == 'd')
		{
			cb++;
			n++;

			if (!used[cur])
			{
				used[cur] = true;
				//a[cur].p.push_back(n);
				//cur = n;
			}
			else
			{
				a[a[cur].p.back()].p.push_back(n);
			}

			a[cur].p.push_back(n);
			st.push(n);
		}
		else
		{
			st.pop();

			if (cb > mb)
				mb = cb;

			cb--;
		}
	}

	rec(0, 0);

	printf("%d %d\n", mb, md);

	return 0;
}