program ProjectA;

uses
  SysUtils;

var
  ch: Char;
  len, i: Word;
  d, dmax, res: Longword;
  str: AnsiString;
  a: array [0..10000] of Word;

begin
  AssignFile(input, 'input.txt');
  reset(input);

  AssignFile(output, 'output.txt');
  rewrite(output);

  a[0] := 1;

  for i:=1 to 10000 do
    a[i] := 0;

  read(str);

  len := length(str);

  dmax := 0;
  d := 0;
  for i:=1 to len do
    begin
      if str[i] = 'd'
      then
        begin
          d:=d+1;

          a[d] := a[d-1] + a[d] + 1;

          if dmax < d
          then
            dmax := d;
        end
      else
        begin
          d:=d-1;
        end;
    end;

  res := 0;

  for i:=1 to 10000 do
    if res < a[i]
    then
      res := a[i];

  write(dmax, ' ', res);

  CloseFile(input);
  CloseFile(output);
end.

