Cut into self-contained pieces

Write partition_sizes(text) that cuts text into as many pieces as possible such that each letter appears in only one piece, and returns the piece lengths in order.

partition_sizes("ababcbacadefegdehijhklij")  ->  [9, 7, 8]
partition_sizes("abc")                       ->  [1, 1, 1]
partition_sizes("aaa")                       ->  [3]

The point is to practise a greedy that extends the current piece to the last occurrence of every letter it contains.

def partition_sizes(text):
    ...