Try it online! Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
Incoming
previous 11 byter:
Ḳs€L}Ḣ=\ƇẎ€
Also a dyadic link as above.
How?
Ḳs€L}Ḣ=\ƇẎ€Ḳœṣ€ḢÐḟj€ - Link: text, prefix
Ḳ - split (text) at spaces -> list of words
} e.g. "fracfracit unfracked", "frac"
Ḳ - use right argument...
- Lsplit (text) at spaces -> list of words - get the length
€["fracfracit", "unfracked"]
€ - for each (word):
s œṣ - split intoaround chunkssublists (ofequal L)to (e.g.prefix) "foobarspam"s3 -> ["foo","bar" ["","spa""","m"])
"it"] ["un","ked"]
ƇÐḟ - filter keepdiscard items for which this is truthy:
Ḣ \ - head
- last-- twoCrucially linksthis asmodifies athe dyadlist: i.e. f(word ["","it"] prefix): ["ked"]
Ḣ - -- and yields the popped item: head
- "" -- Crucially this modifies the list so ["foo","bar","spam","m"]
"un"
- - -- becomesand ["bar","spam","m"]only whilenon-empty yieldinglists "foo"
are truthy: = kept discarded
- equal (to ...so we end up with the prefix)?
list: [["","it"]]
€ - for each (remaining, "decapitated"list wordof lists of characters):
j Ẏ- - join with tightenthe (e.g.prefix ["bar","spam","m"] "fracit" -> "barspam") ["fracit"]
previous 11 byter:
Ḳs€L}Ḣ=\ƇẎ€
Also a dyadic link as above.
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
Incoming
previous 11 byter:
Ḳs€L}Ḣ=\ƇẎ€
Also a dyadic link as above.
How?
Ḳs€L}Ḣ=\ƇẎ€ - Link: text, prefix
Ḳ - split (text) at spaces -> list of words
} - use right argument...
L - get the length
€ - for each (word):
s - split into chunks (of L) (e.g. "foobarspam"s3 -> ["foo","bar","spa","m"])
Ƈ - filter keep items for which this is truthy:
\ - last two links as a dyad i.e. f(word, prefix):
Ḣ - head
- -- Crucially this modifies the list so ["foo","bar","spam","m"]
- -- becomes ["bar","spam","m"] while yielding "foo"
= - equal (to the prefix)?
€ - for each (remaining, "decapitated" word):
Ẏ - tighten (e.g. ["bar","spam","m"] -> "barspam")
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
Ḳœṣ€ḢÐḟj€ - Link: text, prefix e.g. "fracfracit unfracked", "frac"
Ḳ - split (text) at spaces -> list of words ["fracfracit", "unfracked"]
€ - for each (word):
œṣ - split around sublists equal to (prefix) ["","","it"] ["un","ked"]
Ðḟ - filter discard items for which this is truthy:
Ḣ - head
- -- Crucially this modifies the list: ["","it"] ["ked"]
- -- and yields the popped item: "" "un"
- -- and only non-empty lists are truthy: kept discarded
- ...so we end up with the list: [["","it"]]
€ - for each (remaining list of lists of characters):
j - join with the prefix "fracit" - ["fracit"]
previous 11 byter:
Ḳs€L}Ḣ=\ƇẎ€
Also a dyadic link as above.
Jelly, 11(削除) 11 (削除ここまで) 9 bytes
Ḳs€L}Ḣ=\ƇẎ€Ḳœṣ€ḢÐḟj€
A dyadic link accepting the text (a list of characters) on the left and the prefix (a list of characters) on the right which yields a list of lists of characters (the resulting suffixes).
Try it online! Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
How?
Incoming
previous 11 byter:
Ḳs€L}Ḣ=\ƇẎ€
Also a dyadic link as above.
How?
Ḳs€L}Ḣ=\ƇẎ€ - Link: text, prefix
Ḳ - split (text) at spaces -> list of words
} - use right argument...
L - get the length
€ - for each (word):
s - split into chunks (of L) (e.g. "foobarspam"s3 -> ["foo","bar","spa","m"])
Ƈ - filter keep items for which this is truthy:
\ - last two links as a dyad i.e. f(word, prefix):
Ḣ - head
- -- Crucially this modifies the list so ["foo","bar","spam","m"]
- -- becomes ["bar","spam","m"] while yielding "foo"
= - equal (to the prefix)?
€ - for each (remaining, "decapitated" word):
Ẏ - tighten (e.g. ["bar","spam","m"] -> "barspam")
Jelly, 11 bytes
Ḳs€L}Ḣ=\ƇẎ€
A dyadic link accepting the text (a list of characters) on the left and the prefix (a list of characters) on the right which yields a list of lists of characters (the resulting suffixes).
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
How?
Ḳs€L}Ḣ=\ƇẎ€ - Link: text, prefix
Ḳ - split (text) at spaces -> list of words
} - use right argument...
L - get the length
€ - for each (word):
s - split into chunks (of L) (e.g. "foobarspam"s3 -> ["foo","bar","spa","m"])
Ƈ - filter keep items for which this is truthy:
\ - last two links as a dyad i.e. f(word, prefix):
Ḣ - head
- -- Crucially this modifies the list so ["foo","bar","spam","m"]
- -- becomes ["bar","spam","m"] while yielding "foo"
= - equal (to the prefix)?
€ - for each (remaining, "decapitated" word):
Ẏ - tighten (e.g. ["bar","spam","m"] -> "barspam")
Jelly, (削除) 11 (削除ここまで) 9 bytes
Ḳœṣ€ḢÐḟj€
A dyadic link accepting the text (a list of characters) on the left and the prefix (a list of characters) on the right which yields a list of lists of characters (the resulting suffixes).
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
How?
Incoming
previous 11 byter:
Ḳs€L}Ḣ=\ƇẎ€
Also a dyadic link as above.
How?
Ḳs€L}Ḣ=\ƇẎ€ - Link: text, prefix
Ḳ - split (text) at spaces -> list of words
} - use right argument...
L - get the length
€ - for each (word):
s - split into chunks (of L) (e.g. "foobarspam"s3 -> ["foo","bar","spa","m"])
Ƈ - filter keep items for which this is truthy:
\ - last two links as a dyad i.e. f(word, prefix):
Ḣ - head
- -- Crucially this modifies the list so ["foo","bar","spam","m"]
- -- becomes ["bar","spam","m"] while yielding "foo"
= - equal (to the prefix)?
€ - for each (remaining, "decapitated" word):
Ẏ - tighten (e.g. ["bar","spam","m"] -> "barspam")
Jelly, 11 bytes
Ḳs€L}Ḣ=\ƇẎ€
A dyadic link accepting the text (a list of characters) on the left and the prefix (a list of characters) on the right which yields a list of lists of characters (the resulting suffixes).
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
How?
Ḳs€L}Ḣ=\ƇẎ€ - Link: text, prefix
Ḳ - split (text) at spaces -> list of words
} - use right argument...
L - get the length
€ - for each (word):
s - split into chunks (of L) (e.g. "foobarspam"s3 -> ["foo","bar","spa","m"])
Ƈ - filter keep items for which this is truthy:
\ - last two links as a dyad i.e. f(word, prefix):
Ḣ - head
- -- Crucially this modifies the list so ["foo","bar","spam","m"]
- -- becomes ["bar","spam","m"] while yielding "foo"
= - equal (to the prefix)?
€ - for each (remaining, "decapitated" word):
Ẏ - tighten (e.g. ["bar","spam","m"] -> "barspam")
Jelly, 11 bytes
Ḳs€L}Ḣ=\ƇẎ€
A dyadic link accepting the text (a list of characters) on the left and the prefix (a list of characters) on the right which yields a list of lists of characters (the resulting suffixes).
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
Jelly, 11 bytes
Ḳs€L}Ḣ=\ƇẎ€
A dyadic link accepting the text (a list of characters) on the left and the prefix (a list of characters) on the right which yields a list of lists of characters (the resulting suffixes).
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
How?
Ḳs€L}Ḣ=\ƇẎ€ - Link: text, prefix
Ḳ - split (text) at spaces -> list of words
} - use right argument...
L - get the length
€ - for each (word):
s - split into chunks (of L) (e.g. "foobarspam"s3 -> ["foo","bar","spa","m"])
Ƈ - filter keep items for which this is truthy:
\ - last two links as a dyad i.e. f(word, prefix):
Ḣ - head
- -- Crucially this modifies the list so ["foo","bar","spam","m"]
- -- becomes ["bar","spam","m"] while yielding "foo"
= - equal (to the prefix)?
€ - for each (remaining, "decapitated" word):
Ẏ - tighten (e.g. ["bar","spam","m"] -> "barspam")