program pil_6_23_c(input,output);
var
	f, l, cur : char;
  count : integer;
begin
	count := 0;
	read(f,cur);
  l := f;
	while cur<>'.' do begin
		if (cur=',')and(f=l) then begin
			count := count + 1;
	    read(cur);
      l := cur;
			f := cur;
    end;
    l := cur;
    read(cur);
  end;
  if f=l then count := count + 1;
  WriteLn(count);
end.