program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n(ichar('0'):ichar('9'))=0,i
    character(4):: s

    read*, s

    do i=1,4
        n(ichar(s(i:i)))=n(ichar(s(i:i)))+1
    end do
    
    if (maxval(n) >= 3) then
        print'(a)', 'Yes'
    else
        print'(a)', 'No'
    end if
    

end program main