458. Partition Labels
MediumGreedy
Split the string into as many parts as possible so each letter appears in at most one part. Print the part sizes in order.
Input format
One lowercase string
Output format
The part sizes.
Example 1
Input
ababcbacadefegdehijhklij
Output
9 7 8
Example 2
Input
eccbbbbdec
Output
10
Constraints
1 ≤ |s| ≤ 500
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…