# [Brachylog], 13 bytes

    ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+

[Try it online!][TIO-j5i8edrb]

[Brachylog]: https://github.com/JCumin/Brachylog
[TIO-j5i8edrb]: https://tio.run/##SypKTM6ozMlPN/r//@GO1kfzV1SfWP5w64S6hzuaaw9Pz3g0fyWQp/3/f7ShDgLGIyEwjP0fBQA "Brachylog – Try It Online"