Program Zif_6_26_V(input,output);
var c,b1,be:char;
    k:integer;
begin
     read(c);b1:=c;k:=0;
     repeat
      be:=c;
      read(c);
      if (c=',')or(c='.') then
      if be=b1 then k:=k+1;
      if be=','then b1:=c
     until c='.';
     writeln(k)
End.
