Partition String

Given a string s, build a partition from left to right. Start a segment at the first unconsumed character and extend it one character at a time until the segment has not appeared in any earlier segment. Emit that segment, mark it as used, and continue at the next character. Return the emitted segments in order. Every emitted segment is non-empty and no two emitted segments are equal.

  • Input: arg1 = "abbccccd"
  • Output: ["a", "b", "bc", "c", "d"]
Examples
Input: []
Output: 0
Hints

Partition String

Given a string `s`, build a partition from left to right. Start a segment at the first unconsumed character and extend it one character at a time until the segment has not appeared in any earlier segment. Emit that segment, mark it as used, and continue at the next character. Return the emitted segments in order. Every emitted segment is non-empty and no two emitted segments are equal.