program ProjectA;

uses
  SysUtils;

var
  ch: Char;
  d, i, res: Word;
  a: array [1..10000] of Word;
  fin, fout: TextFile;

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

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

  a[1] := 1;

  d := 1;
  while not(eof(fin)) do
    begin
      read(fin, ch);

      if ch = 'd'
      then
        d := d + 1
      else
        begin
          a[d] := a[d] + 1;

          d := d - 1;
        end;
    end;

  res := 0;

  i:=1;
  while a[i]<>0 do
    begin
      if a[i] = 0
      then
        begin
                    
        end;

      i:=i+1;
    end;

  CloseFile(fin);
  CloseFile(fout);
end.

