← 返回 microsoft 的题目列表Streaming Sequence with Delimiter
类型:online_judge
Given a streaming sequence of data and a delimiter, design a system to process the data stream in real-time. The system should be able to capture and output all data segments preceding each detected delimiter. Provide comprehensive test cases to verify your solution. Assume the data stream consists of characters, and the delimiter is a single character.
Example:
Input:
Stream data: 'abc|def|gh'
Delimiter: '|'
Output:
['abc', 'def']
Constraints:
Each data segment is at most 100 characters long.
The total length of the data stream does not exceed 10^6 characters.
Example
Input
abc|def|ghi|