// 
#pragma comment(linker, "/STACK:16777215")
#include <cmath>
#include <cstring>
#include <ctime>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <string>
using namespace std;



struct T 
{
	int n;
	int root;
	int level;
	vector<int> links;
};

vector<T> tree;

const int go2(const int t, const vector<int> &sos, const int s)
{
	int r=0;
	if (s<sos.size())
	{
		r= 1+go2(sos[s], sos, s+1);
	}
	if (tree[t].links.size()>0)
	{
		r=  max(r, 1+go2(tree[t].links[0], tree[t].links, 1));
	}
	return r;
}


int main()
{
	int i, j, k;
	string scmd;
	T tmp;
	int troot=0, proot=-1;
	int level=0, rlevel=0;
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cin>>scmd;
	tmp.n=0;
	tmp.root=-1;
	tree.push_back(tmp);
	for(i=0; i<scmd.size(); ++i)
	{
		if (scmd[i]=='d')
		{
			level++;
			if (rlevel<level)
				rlevel=level;
			
			tmp.n= tree.size();
			tmp.links.resize(0);
			tmp.root= troot;
			tmp.level= level;

			tree.push_back(tmp);

			proot= troot;
			troot= tree.size()-1;
			tree[proot].links.push_back(troot);
		}
		else
		{
			troot= tree[troot].root;
			proot= tree[troot].root;
			level--;
		}
	}

	cout << rlevel << ' ' << go2(0, vector<int>(), 0);
 	return 0;
}