program name
    use,intrinsic :: iso_fortran_env
    implicit none
    character(100000):: s
    integer(int32):: cnt(3),l,i

    read*, s
    l= len_trim(s)
    cnt(:) = 0
    do i=1,l
        cnt(ichar(s(i:i))-ichar('a')+1)=cnt(ichar(s(i:i))-ichar('a')+1)+1
    end do

    if (maxval(cnt) - minval(cnt) <= 1) then
        print'(a)', 'YES'
    else
        print'(a)', 'NO'
    end if
end program name