Partition Labels
You are given a string s. Partition the string into as many parts as possible so that each letter appears in at most one part.
Note that the partition is done so that after concatenating all the parts in order, the resultant string should be s.
Return a list of integers representing the size of these parts.
Example 1
Input
s = "ababcbacadefegdehijhklij"Output
[9,7,8]The partition is "ababcbaca", "defegde", "hijhklij", so each letter appears in at most one part and the number of parts is maximized.
Example 2
Input
s = "eccbbbbdec"Output
[10]The entire string must remain one part because its letters overlap across the whole string.
Constraints
- 1 <= s.length <= 500
- s consists of lowercase English letters.