var a:string;i:integer;beginreadln(a);a:=a+' ';while length(a)>0 do beginif a[1]='a' then inc(i);delete(a,1,pos(' ',a));end;writeln(i);end.