#include <iostream>
#include <stdio.h>
#include <vector>
#include <stack>
using namespace std;

struct Tree
{
	int value;
	Tree* next;
	Tree* child;
	Tree* parent;
};


char c=0, last=-1;
int n,i, mx1=0, j=0;
Tree* cur;
vector <Tree*> arr;
stack <Tree*> q;
int mx2=0, k=0;

void ppc(Tree* root)
{
	k++;
	if(k>mx2)
		mx2=k;
	//cout << root->value;
	if(root->child!=NULL)
		ppc(root->child);
	if(root->next!=NULL)
		ppc(root->next);
	k--;
};


int main()
{
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	cur=new Tree();
	arr.push_back(cur);
	cur->child=NULL;
	cur->next=NULL;
	cur->parent=NULL;
	do
	{
		c=getchar();
		if(c==-1)
			break;
		
		if(last!=c)
		{
			if(j>mx1)
				mx1=j;
			j=0;
		}
		j++;
		if(c=='d')
		{
			n++;
			Tree* tmp=cur;
			Tree* last=NULL;
			cur=cur->child;
			if(cur!=NULL)
			{
				do
				{
					last=cur;
					cur=cur->next;
				}
				while(cur!=NULL);
			}
			cur=new Tree();
			cur->value=n;
			arr.push_back(cur);
			if(tmp->child==NULL)
				tmp->child=cur;
			cur->parent=tmp;
			if(last!=NULL)
				last->next=cur;
			cur->child=NULL;
			cur->next=NULL;
		}
		else if(c=='u')
		{
			cur=cur->parent;
		}
		last=c;
	}
	while(true);

	q.push(arr[0]);
	ppc(arr[0]);
	cout << mx1 << " " << mx2-1;
	
	return 0;
}