program Project2;

{$R+ $S+ $W+ $O+}

uses
  SysUtils;

Var f:text;
    a:Char;
    h,max,N,I:Integer;
    add,mh,m,mn:array[0..10001] of Integer;

begin
  assign(f,'input.txt');
  ReSet(f);

  FillChar(mh,sizeof(mh),0);
  FillChar(m,sizeof(m),0);
  FillChar(mn,sizeof(mn),0);
  h:=0; max:=0; N:=0;
  while not(eof(f)) do
    begin
      read(f,a);
      if (a='d')
      then begin
             Inc(h); Inc(mh[h]);
             if (h>max) then max:=h;
             Inc(N); m[N]:=h; mn[N]:=mh[h];
           end
      else Dec(h);
    end;


  Close(f);
  assign(f,'output.txt');
  ReWrite(f);
  write(f,max,' ');

  FillChar(mh,sizeof(mh),0);
  max:=0;
  for I:=1 to N do
    begin
      (*if (mn[I]=1)
      then Add[I]:=Add[I-1]
      else if m[I-1]=m[I] then Add[I]:=Add[I-1]+1{mn[I]-1{}
                          else Add[I]:=mh[m[I]]+1;
      mh[m[I]]:=Add[I];
      h:=m[I]+Add[I];*)
      if mn[I]=1
      then Add[I]:=Add[I-1]
      else Add[I]:=mh[m[I]]+1;
      mh[m[I]]:=Add[I];
      h:=m[I]+Add[I];
      if (h>max) then max:=h;
    end;

  writeln(f,max);

  Close(f);

end.
