#include <fstream>

using namespace std;

int stack[10000+1];
int h = 0;

int sum (int k) {
	int r = 0;
	for(int i = 0; i <= k; r += stack[i++]);
	return r;
}

int main () {
	ifstream in;
	in.open("input.txt");

	int h_fst = 0 , h_fst_tmp, h_snd = 0;
	char c;
	
	for( int i = 0; i<10000; stack[i++] = 0);


	in >> c;
	while ( ! in.eof() ) {
		if( c=='d') { 
			h_fst_tmp ++ ;
			if ( h_fst_tmp > h_fst) h_fst = h_fst_tmp;

			stack[++h]++;

		} else {
			h_fst_tmp--;
			
			if ( h_snd<(stack[h-1]+stack[h]) ) h_snd = sum(h);
			h--;
		}

		in >> c;
	}

	ofstream out;
	out.open("output.txt");

	out << h_fst << ' ' << h_snd;

	in.close();
	out.close();
}