Jelly, 1924 bytes
ḣ2ŒliⱮ=Ø.
ḲçƇ)hsQḣ7ḲQçƇ)hsḣJf7ḢƊ$
ḣ2ŒliⱮ=Ø. - Helper Link, valid word?: list of characters, Word; identifiers ("hs")
ḣ2 - head Word to index two - e.g. "Child" -> "Ch"
Œl - lower-case -> X -> X = "ch"
Ɱ - map across C in identifiers with:
i - first (1-indexed) index of C in X -> [2,0]
('h' at index 2, no 's' exists)
Ø. - [0,1]
= - equal?
ḲçƇ)hsQḣ7ḲQçƇ)hsḣJf7ḢƊ$ - Link get s-words: list of characters, T
Ḳ - split T at space characters -> Words
Q - deduplicate
)hs - set the right argument to "hs"
Ƈ - filter keep those Words for which:
ç - call the helper Link as a dyad - f(Word, "hs")
Q $ - deduplicatelast two links as a monad - f(ValidWords):
ḣ7 Ɗ - last three links as a monad - g(ValidWords):
J - range of length -> [1,2,...,number of valid words]
7 - seven
f - filter-keep -> [7] or [] if less than seven valid words
Ḣ - head -> 7 or 0
ḣ - head of ValidWords to indexthat sevenindex
Jelly, 19 bytes
ḣ2ŒliⱮ=Ø.
ḲçƇ)hsQḣ7
ḣ2ŒliⱮ=Ø. - Helper Link, valid word?: list of characters, Word; identifiers ("hs")
ḣ2 - head Word to index two - e.g. "Child" -> "Ch"
Œl - lower-case -> X -> X = "ch"
Ɱ - map across C in identifiers with:
i - first (1-indexed) index of C in X -> [2,0]
('h' at index 2, no 's' exists)
Ø. - [0,1]
= - equal?
ḲçƇ)hsQḣ7 - Link get s-words: list of characters, T
Ḳ - split T at space characters -> Words
)hs - set the right argument to "hs"
Ƈ - filter keep those Words for which:
ç - call the helper Link as a dyad - f(Word, "hs")
Q - deduplicate
ḣ7 - head to index seven
Jelly, 24 bytes
ḣ2ŒliⱮ=Ø.
ḲQçƇ)hsḣJf7ḢƊ$
ḣ2ŒliⱮ=Ø. - Helper Link, valid word?: list of characters, Word; identifiers ("hs")
ḣ2 - head Word to index two - e.g. "Child" -> "Ch"
Œl - lower-case -> X -> X = "ch"
Ɱ - map across C in identifiers with:
i - first (1-indexed) index of C in X -> [2,0]
('h' at index 2, no 's' exists)
Ø. - [0,1]
= - equal?
ḲQçƇ)hsḣJf7ḢƊ$ - Link get s-words: list of characters, T
Ḳ - split T at space characters -> Words
Q - deduplicate
)hs - set the right argument to "hs"
Ƈ - filter keep those Words for which:
ç - call the helper Link as a dyad - f(Word, "hs")
$ - last two links as a monad - f(ValidWords):
Ɗ - last three links as a monad - g(ValidWords):
J - range of length -> [1,2,...,number of valid words]
7 - seven
f - filter-keep -> [7] or [] if less than seven valid words
Ḣ - head -> 7 or 0
ḣ - head of ValidWords to that index
Jelly, 19 bytes
Assuming that we must handle uppercase S and H too and that we must/may return the leftmost distinct "s-words"
ḣ2ŒliⱮ=Ø.
ḲçƇ)hsQḣ7
A monadic Link that accepts a list of characters and yields a list of the words.
How?
ḣ2ŒliⱮ=Ø. - Helper Link, valid word?: list of characters, Word; identifiers ("hs")
ḣ2 - head Word to index two - e.g. "Child" -> "Ch"
Œl - lower-case -> X -> X = "ch"
Ɱ - map across C in identifiers with:
i - first (1-indexed) index of C in X -> [2,0]
('h' at index 2, no 's' exists)
Ø. - [0,1]
= - equal?
ḲçƇ)hsQḣ7 - Link get s-words: list of characters, T
Ḳ - split T at space characters -> Words
)hs - set the right argument to "hs"
Ƈ - filter keep those Words for which:
ç - call the helper Link as a dyad - f(Word, "hs")
Q - deduplicate
ḣ7 - head to index seven
Jelly, 19 bytes
Assuming that we must handle uppercase S and H too and that we must/may return the leftmost distinct "s-words"
ḣ2ŒliⱮ=Ø.
ḲçƇ)hsQḣ7
A monadic Link that accepts a list of characters and yields a list of the words.
How?
ḣ2ŒliⱮ=Ø. - Helper Link, valid word?: list of characters, Word; identifiers ("hs")
ḣ2 - head Word to index two - e.g. "Child" -> "Ch"
Œl - lower-case -> X -> X = "ch"
Ɱ - map across C in identifiers with:
i - first (1-indexed) index of C in X -> [2,0]
('h' at index 2, no 's' exists)
Ø. - [0,1]
= - equal?
ḲçƇ)hsQḣ7 - Link get s-words: list of characters, T
Ḳ - split T at space characters -> Words
)hs - set the right argument to "hs"
Ƈ - filter keep those Words for which:
ç - call the helper Link as a dyad - f(Word, "hs")
Q - deduplicate
ḣ7 - head to index seven
Loading
Loading