#pragma comment(linker,"/STACK:16777216")
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<time.h>s
#define eps 1e-15
using namespace std;
char s;
struct dd
{
	int o, l, n, lw;
	int s[10001];
}a[10001];

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	int i, k, g1=0, l, g=1, g2=0, t=0, o, j;
	//gets(s);
	bool fl=1;
	l=0;
	k=1;
	a[1].l=1;
	a[1].o=0;
	t=1;
	//l=strlen(s);
	a[0].n=0;
	a[0].l=0;
	o=0;
	scanf("%c", &s);
	while(scanf("%c", &s)!=EOF)
	if(s=='d'||s=='u')
	{
		if(s=='d')
		{
			if(fl)
			{
				k++;
				a[t+1].o=t;
				o=t+1;
			}
			else
			{
				fl=1;
				k=a[o].l+1;
				a[t+1].o=o;
				o=t+1;
				//a[o][0]++;
			}
			t++;
			a[t].l=k;
			if(k==1)
				g=t;
		}
		else
		{
			if(fl)
			{
				fl=0;
				if(k>g1)
					g1=k;
				o=a[t].o;
				a[o].n++;
				a[o].s[a[o].n]=t;
			}
			else
			{
				a[a[o].o].n++;
				a[a[o].o].s[a[a[o].o].n]=o;
				o=a[o].o;
				k=a[o].l;
			}
		}
	}
	cout<<g1<<' ';
	g1=0;
	a[0].lw=0;
	for(i=0; i<=t; i++)
	{
		k=1;
		for(j=1; j<=a[i].n; j++)
		{
			a[a[i].s[j]].lw = a[i].lw+k;
			k++;
		}
		if(a[i].lw+k-1>g1)g1=a[i].lw+k-1;
	}
		
	cout<<g1;
	return 0;
}