Your question is Split String by Substring. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Hyundai MOBIS Alabama receives diagnostic strings containing repeated markers that separate individual vehicle records. Given a string text and a non-empty marker string pattern, split text at every non-overlapping occurrence of pattern.
Return the substrings between consecutive matches, excluding the marker itself. Preserve empty substrings caused by consecutive markers or markers at the beginning or end. Matches must be selected from left to right, and an occurrence cannot overlap a previously selected occurrence.
text and pattern, containing printable ASCII characters.text between matches.pattern does not occur, return [text].pattern is guaranteed to be non-empty.For efficient matching, implement the search using the Knuth-Morris-Pratt prefix-function technique rather than repeatedly rescanning the text.
def split_by_marker(text, pattern):