#include <iostream>
#include <fstream>
#include <string.h>
#include <math.h>

using namespace std;

int maximum = -1;

struct tree
{
	int val;
	int jump;
	tree *left;
	tree *right;

	tree *parent;
};

void print(tree *cur, int cnt)
{
	if (cnt > maximum)
		maximum = cnt;
	//cout << "[" << cnt << " | " << maximum << "]";
	if (cur->right != 0)
	{
		//cout << "right(" << cur->val << ") ";
		print(cur->right, cnt + 1);
	}
	if (cur->left != 0)
	{
		//cout << "left(" << cur->val << ") ";
		print(cur->left, cnt + 1);
	}
}

int main()
{
	ifstream input("input.txt", ios::in);
	ofstream output("output.txt", ios::out);
	
	char *str = new char[10000];
	input >> str;

	tree *root = new tree();
	tree *cur = root;

	int len = strlen(str);
	int cnt = 0;
	int max = -1;

	int cnt_next = 0;
	int max_next = -1;
	
	for (int i = 0; i < len; i++)
	{
		//cout << "test: " << cnt_next << " / " << max_next << endl; 
		if (str[i] == 'd')
		{
			cnt++;
			if (cur->left == 0)
			{
				cur->left = new tree();
				cur->left->val = cnt;
				cur->left->jump = 1;
				cur->left->parent = cur;
				
				cur = cur->left;
				cnt_next++;
				if (cnt_next > max_next)
					max_next = cnt_next;
			}
			else
			{
				tree *test = cur->left;
				cnt_next++;
				int cnt2 = 1;
				while (test->right != 0)
				{
					test = test->right;
					cnt_next++;
					cnt2++;
				}
				if (cnt_next > max_next)
					max_next = cnt_next;
				test->right = new tree();
				test->right->val = cnt;
				cur->left->jump = cnt2;
				test->right->parent = cur;
				cur = test->right;
			}
		}
		else if (str[i] == 'u')
		{
			cnt--;
			cnt_next -= cur->jump;
			cur = cur->parent;
		}
		if (cnt > max) max = cnt;
	}
	//cout << "MAX: " << max << endl;
	output << max << " ";

	
	//print(root, 0);
	//output << maximum;
	output << max_next << endl;

	//cur = root;
	//while (cur != 0)
	//{
	//	cout << "left(" << cur->val << ") ";
	//	cur = cur->right;
	//}
	
	//cin.get();
	return 0;
}