Most pieces with no shared letters
Cut the string s into as many contiguous pieces as possible so that every letter appears in only one piece: all copies of a letter land in the same piece. Return the lengths of the pieces, from left to right.
s holds only lowercase letters and may be empty (return []). Aim for O(n) time.
Besides the tests, one large input (a 12,000-letter string) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
piece_sizes("abacbdeffe")→[5,1,4]piece_sizes("abcd")→[1,1,1,1]piece_sizes("abcda")→[5]