Partition Labels

MediumGreedy
Next
GreedyStringTwo Pointers

Split a string into as many parts as possible so that each letter appears in at most one part. Print the size of each part, in order.

Input

A single string of lowercase letters.

Output

Print the part sizes on one line, separated by spaces.

Constraints

1 <= length <= 500

Example 1
Input
ababcbacadefegdehijhklij
Output
9 7 8

Parts: ababcbaca, defegde and hijhklij, of sizes 9, 7 and 8.

Hints

Partition Labels - Medium Greedy Problem | Skill Shiksha