# [MATL], <s>21</s> <s>20</s> 19 bytes

_Translation of [@elementiro's MATLAB/Octave answer](https://codegolf.stackexchange.com/a/229648/36398), with small modifications_.

    O4LZ(Gz:"2Y6Z+G*]aA

[Try it online!][TIO-kpxtl2z9] Or [verify all test cases][TC].

[MATL]: https://github.com/lmendo/MATL
[TIO-kpxtl2z9]: https://tio.run/##y00syfn/39/EJ0rDvcpKySjSLErbXSs20fH//2hDBQg0sFYwAEMoE0nUECKDEDWMBQA
[TC]:
https://tio.run/##y00syfmf8N/fxCdKw73KSsko0ixK210rNtHxv0tURcj/aAMFILRWMARBKBXLFQ2ioaIwCixqAFJkABM1AKsFy0D1QDWADYUxkUQNFaDWwUQJ6TPAqQ8A