Post History
BQN, 8 bytesSBCS ∾⊒˜¨⊔○∾⊢ Run online! and parsing diagram The idea here is to build a list of groups, with group i containing the ith character of each string that has one, then join the group...
Answer
#1: Initial revision
# [BQN](https://mlochbaum.github.io/BQN/), 8 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup> ``` ∾⊒˜¨⊔○∾⊢ ``` [Run online!](https://mlochbaum.github.io/BQN/try.html#code=V1Yg4oaQIOKIvuKKksucwqjiipTil4viiL7iiqIKCldWwqjin6gKICAia2lubyLigL8iY2luZW1hIuKAvyJtb3ZpZSIKICAiY29kZSLigL8iZ29sZiIKICAiSGki4oC/IiLigL8iVGhlcmUiCiAg4p+oIkV4cGxhbmF0aW9uIuKfqQogICJEeWFsb2cgQVBMIuKAvyJDdWx0aXZhdGlvbiLigL8iT3JjaGFyZCIK4p+p) and [parsing diagram](https://mlochbaum.github.io/BQN/try.html#code=4oi+4oqSy5zCqOKKlOKXi+KIvuKKog==&explain) The idea here is to build a list of groups, with group `i` containing the `i`<sup>th</sup> character of each string that has one, then join the groups. The structure `∾ ⊒˜¨ ⊔○∾ ⊢` is a [train](https://mlochbaum.github.io/BQN/doc/train.html) of four functions: the last three form a 3-train and then [Join](https://mlochbaum.github.io/BQN/doc/join.html) (`∾`) is applied to the result. ``` ∾⊒˜¨⊔○∾⊢ ⊢ # Argument, unchanged ⊒˜¨ # Indices for each string ⊔○∾ # Join both and group ∾ # Join group result ``` The function `⊒˜¨` converts a list of strings such as `⟨"ab","cde"⟩` into indices `⟨0‿1,0‿1‿2⟩`. [Occurrence Count](https://mlochbaum.github.io/BQN/doc/selfcmp.html#occurrence-count) searches for cells of the right argument in the left argument, taking the first match and never matching a cell more than once. When applied with the same list as left and right argument using `˜`, it always matches each cell to itself as any previous cells that match it are used up. The result is the index of each match, giving sequential indices. Each (`¨`) simply applies this function to each string. [Group](https://mlochbaum.github.io/BQN/doc/group.html) moves each character to the group with the specified index. For example, `0‿1‿0‿1‿2⊔"abcde"` is `⟨"ac","bd","e"⟩`. Since its arguments must be flat lists, not nested ones, it's applied as Group Over (`○`) Join, joining both arguments before applying. Instead of grouping and joining, it's also possible to sort by the indices with `⊒˜¨⍋⊸⊏○∾⊢`. But longer.