# [Jelly], <s>18</s> <s>16</s> <s>12</s> 10 bytes Ġ¬zḊḊ¬zĠȦȦ [Try it online!][TIO-je8p8ot2] ### How it works Ġ¬zḊḊ¬zĠȦȦ Main link. Argument: s (string) Ġ Group the indices of s by their corresponding elements. "abcba" -> [[1, 5], [2, 4], [3]] ¬ Take the logical NOT of each 1-based(!) index. [[1, 5], [2, 4], [3]] -> [[0, 0], [0, 0], [0]] Ḋ Dequeue; yield s without its fist element. "abcba" -> "bcba" z Zip-longest; zip the elements of the array to the left, using the string to the right as filler. ([[0, 0], [0, 0], [0]], "bcba") -> [[0, 0, 0], [0, 0, "bcba"]] ¬ Take the logical NOT of all zeros and characters. [[0, 0, 0], [0, 0, "bcba"]] -> [[1, 1, 1], [1, 1, [0, 0, 0, 0]] Ġ Grid. z Zip-longest. Since all arrays in the result to the left have the same number of elements, this is just a regular zip. [[1, 1, 1], [1, 1, [0, 0, 0, 0]] -> [[1, 1], [1, 1], [1, [0, 0, 0, 0]] Ȧ Any and all; test if the result is non-empty and contains no zeroes, at any depth. Yield 1 if so, 0 if not. [[1, 1], [1, 1], [1, [0, 0, 0, 0]] -> 0 Ȧ Any and all. 0 -> 0 [Jelly]: https://github.com/DennisMitchell/jelly [TIO-je8p8ot2]: https://tio.run/##bY@3ktpgFIV7nuIXIiOCyDmDyDlrBCiDEFEiSEDjxjN@iq222gdwbW@xr2G/iKz1ejvfOcV3z5zmE1hRVDTt9enHi/rr@zc9Orw@vT2/PWs/v/7@8qIH0zTcAHDj/0ZGAgEwkFiRAzIrye8zUj8jYgBAJwgFKIBIAKGfDUXRNMOwLMfx/EeHdqDhnOutsqHccXW7P@R1oUEMhWY1OZsHbKQlmQ7uJiSCXpb3bmBSGwA4SkNwB/Qt3CImbUyZ8dl14keJtl18jNqpklUQ/dcNY41WWFOjGe8f87m8R55W6g7MF6aU4tbNe9e1JdU1pzCXO7gv03WvvTpdSDEHfvX11FDEfJ6VdxEnziK3VvawTfuLiVbpMrbFM8qJcKphz545DAq6@l/df2YU9S73@dAfQHW4UI/OBplYYE5W7QXC55g1zrbio0aFdxlifWTPozTb95ZG8cq9GltdgTkK@UuXTdwxmGLlRUQepngFvY4TPU8rG27KOeuDBifr0FRHJuJkf4Nxt1uw8P11RNi7Ql0RG9TheWLmzeentXaHK/jMkn3JunKN7gndpg/MygMFD8nL1rQ7ks4x0m6parm5TNoCt83CH63cJdxZzFiUlJEwEH8A "Jelly – Try It Online"