   program abc150b
      implicit none
      character(50)::s
      integer::i,n,ans
      
         read *, s
         n=len_trim(s)
         
         ans=0
         do i=1,n-2
            if (s(i:i+2)=='ABC') ans=ans+1
         end do
         
         print *,ans
         
   end program abc150b