Skip to main content
deleted 39 characters in body
Source Link
FrownyFrog
  • 3.8k
  • 1
  • 14
  • 20

J, 30 29 25 bytes

1(|:(0{-.&,)"_1]\.)<\\.&>

Try it online!

                   <\\.&>        a 3-dimensional array of substrings
1 |:                             transpose each matrix to sort the substrings by length
1              ]\.               all choices where one word is
                                  missing
    (0{-.&,)"_1                  for every matrix, flatten, remove substrings
                                  that are present in the
  corresponding complement,
                                corresponding complement, pick first

J, 30 29 25 bytes

1(|:(0{-.&,)"_1]\.)<\\.&>

Try it online!

                   <\\.&>        a 3-dimensional array of substrings
1 |:                             transpose each matrix to sort the substrings by length
1              ]\.               all choices where one word is
                                  missing
    (0{-.&,)"_1                  for every matrix, flatten, remove substrings
                                  that are present in the
                                   corresponding complement, pick first

J, 30 29 25 bytes

1(|:(0{-.&,)"_1]\.)<\\.&>

Try it online!

                   <\\.&>        a 3-dimensional array of substrings
1 |:                             transpose each matrix to sort the substrings by length
1              ]\.               all choices where one word is missing
    (0{-.&,)"_1                  for every matrix, flatten, remove substrings
                                  that are present in the corresponding complement,
                                  pick first
deleted 185 characters in body
Source Link
FrownyFrog
  • 3.8k
  • 1
  • 14
  • 20

[J]J, 30 29 2925 bytes

i.@#1(|:(0{{-.&,}.@|)"_1]\.)"{1|:<\\.&>

Try it online!Try it online!

                   <\\.&>    <\\.&>    a 3-dimensional array of substrings
1 |:                   1|:          transpose each matrix to sort the substrings by length
i.@#  1            "{   ]\.          for each n in [0..number of strings)
all choices where one word is
       }.@|.                    drop the first matrix after rotating by nmissing
       (0{            -.&,)"_1                 pick thefor n-thevery matrix
 , flatten, remove substrings
    -.&,                         remove any substring found on thethat rightare sidepresent fromin the left side
     0{                             corresponding pickcomplement, thepick first one

Using grade up, /: instead of i.@# could save 2 bytes but it sorts the output in the alphabetical order of the input. [J]: http://jsoftware.com/ [TIO-jhy1tmqt]: https://tio.run/##y/r/P81WTyFTz0FZw6C6Wk9XT02nVk/ToUZPqdqwxsomJkZPze5/anJGvkKagrqOenJpiYJ6RmpOTr5ORiKYzM9JVOdCU1BQkJyOIZiTX5Saq5NZUFyaq5OSD@TpFGeW6CTmppao//8PAA "J – Try It Online"

[J], 30 29 bytes

i.@#(0{{-.&,}.@|.)"{1|:<\\.&>

Try it online!

                       <\\.&>    a 3-dimensional array of substrings
                    1|:          transpose each matrix to sort the substrings by length
i.@#              "{             for each n in [0..number of strings)
            }.@|.                    drop the first matrix after rotating by n
       {                             pick the n-th matrix
        -.&,                         remove any substring found on the right side from the left side
     0{                              pick the first one

Using grade up, /: instead of i.@# could save 2 bytes but it sorts the output in the alphabetical order of the input. [J]: http://jsoftware.com/ [TIO-jhy1tmqt]: https://tio.run/##y/r/P81WTyFTz0FZw6C6Wk9XT02nVk/ToUZPqdqwxsomJkZPze5/anJGvkKagrqOenJpiYJ6RmpOTr5ORiKYzM9JVOdCU1BQkJyOIZiTX5Saq5NZUFyaq5OSD@TpFGeW6CTmppao//8PAA "J – Try It Online"

J, 30 29 25 bytes

1(|:(0{-.&,)"_1]\.)<\\.&>

Try it online!

                   <\\.&>        a 3-dimensional array of substrings
1 |:                             transpose each matrix to sort the substrings by length
1              ]\.               all choices where one word is
                                  missing
    (0{-.&,)"_1                  for every matrix, flatten, remove substrings
                                  that are present in the
                                  corresponding complement, pick first
added 668 characters in body
Source Link
FrownyFrog
  • 3.8k
  • 1
  • 14
  • 20

[J], 30 29 bytes

i.@#(0{{-.&,}.@|.)"{1|:<\\.&>

Try it online!

                       <\\.&>    a 3-dimensional array of substrings
                    1|:          transpose each matrix to sort the substrings by length
i.@#              "{             for each n in [0..number of strings)
            }.@|.                    drop the first matrix after rotating by n
       {                             pick the n-th matrix
        -.&,                         remove any substring found on the right side from the left side
     0{                              pick the first one

Using grade up, /: instead of i.@# could save 2 bytes but it sorts the output in the alphabetical order of the input. [J]: http://jsoftware.com/ [TIO-jhy1tmqt]: https://tio.run/##y/r/P81WTyFTz0FZw6C6Wk9XT02nVk/ToUZPqdqwxsomJkZPze5/anJGvkKagrqOenJpiYJ6RmpOTr5ORiKYzM9JVOdCU1BQkJyOIZiTX5Saq5NZUFyaq5OSD@TpFGeW6CTmppao//8PAA "J – Try It Online"

[J], 30 29 bytes

i.@#(0{{-.&,}.@|.)"{1|:<\\.&>

Try it online!

                       <\\.&>    a 3-dimensional array of substrings
                    1|:          transpose each matrix to sort the substrings by length
i.@#              "{             for each n in [0..number of strings)
            }.@|.                drop the first matrix after rotating by n
       {                         pick the n-th matrix
        -.&,                     remove any substring found on the right side from the left side
     0{                          pick the first one

Using grade up, /: instead of i.@# could save 2 bytes but it sorts the output in the alphabetical order of the input. [J]: http://jsoftware.com/ [TIO-jhy1tmqt]: https://tio.run/##y/r/P81WTyFTz0FZw6C6Wk9XT02nVk/ToUZPqdqwxsomJkZPze5/anJGvkKagrqOenJpiYJ6RmpOTr5ORiKYzM9JVOdCU1BQkJyOIZiTX5Saq5NZUFyaq5OSD@TpFGeW6CTmppao//8PAA "J – Try It Online"

[J], 30 29 bytes

i.@#(0{{-.&,}.@|.)"{1|:<\\.&>

Try it online!

                       <\\.&>    a 3-dimensional array of substrings
                    1|:          transpose each matrix to sort the substrings by length
i.@#              "{             for each n in [0..number of strings)
            }.@|.                    drop the first matrix after rotating by n
       {                             pick the n-th matrix
        -.&,                         remove any substring found on the right side from the left side
     0{                              pick the first one

Using grade up, /: instead of i.@# could save 2 bytes but it sorts the output in the alphabetical order of the input. [J]: http://jsoftware.com/ [TIO-jhy1tmqt]: https://tio.run/##y/r/P81WTyFTz0FZw6C6Wk9XT02nVk/ToUZPqdqwxsomJkZPze5/anJGvkKagrqOenJpiYJ6RmpOTr5ORiKYzM9JVOdCU1BQkJyOIZiTX5Saq5NZUFyaq5OSD@TpFGeW6CTmppao//8PAA "J – Try It Online"

added 668 characters in body
Source Link
FrownyFrog
  • 3.8k
  • 1
  • 14
  • 20
Loading
added 155 characters in body
Source Link
FrownyFrog
  • 3.8k
  • 1
  • 14
  • 20
Loading
Source Link
FrownyFrog
  • 3.8k
  • 1
  • 14
  • 20
Loading