# [Retina], 41 bytes

    .*$
    $*
    !&`(.)+(?=.*¶(?<-1>.)+(?(1)(?!))$)

[Try it online!]

Takes the string and count on separate lines. The first two lines are used to convert the count from decimal to unary, so if unary input is acceptable then the byte count would be reduced to 34.

[Retina]: https://github.com/m-ender/retina
[Try it online!]: https://tio.run/nexus/retina#@6@npcKlosWlqJagoaeprWFvq6d1aJuGvY2uoR2Yr2GoqWGvqKmpovn/v2OIs7ujo7s7kArhMgEA "Retina – TIO Nexus"