# [05AB1E], 19 bytes

    áΣl}.γl}εgyθ‚}Σl}JJ

[Try it online!][TIO-jr1ps06z]
or as a [Test Suite](https://tio.run/##yy9OTMpM/V9TVvn/8MJzi3Nq9c5tzqk9tzW98tyORw2zakFCXl7/K@2VFHTtFJTsdf57Z5ZkJ5YohCTmpedzuSSWJCYlFqcqBCQWlWSWZObnFQNlirMB)

[05AB1E]: https://github.com/Adriandmen/05AB1E
[TIO-jr1ps06z]: https://tio.run/##yy9OTMpM/f//8MJzi3Nq9c5tzqk9tzW98tyORw2zakFCXl7//7skliQmJRanKgQkFpVklmTm5xUrhCQWZwMA "05AB1E – Try It Online"