#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, short cnt)
{
	if (cnt > maximum)
		maximum = cnt;
	//cout << "[" << cnt << " | " << maximum << "]";
	if (cur->left != 0)
	{
		//cout << "left(" << cur->val << ") ";
		print(cur->left, cnt + 1);
	}
	if (cur->right != 0)
	{
		//cout << "right(" << cur->val << ") ";
		print(cur->right, cnt + 1);
	}
}

int main()
{
	ifstream input("input.txt", ios::in);
	ofstream output("output.txt", ios::out);
	
	char *str = new char[65535];
	memset(str, 0, 65535);
	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 = cur->jump + 1;
				cur->left->parent = cur;
				
				cur = cur->left;
				if (cur->jump > max_next)
					max_next = cur->jump;
			}
			else
			{
				tree *test = cur->left;
				while (test->right != 0)
					test = test->right;
				test->right = new tree();
				//test->right->val = cnt;
				test->right->jump = test->jump + 1;
				test->right->parent = cur;
				cur = test->right;
				if (cur->jump > max_next)
					max_next = cur->jump;
			}
		}
		else if (str[i] == 'u')
		{
			cnt--;
			cur = cur->parent;
		}
		if (cnt > max) max = cnt;
	}
	
	//cout << "MAX: " << max << endl;
	output << max << " ";

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

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