LeetCode 763. Partition Labels

Input: S = “ababcbacadefegdehijhklij”Output: [9,7,8]Explanation:The partition is “ababcbaca”, “defegde”, “hijhklij”.This is a partition so that each letter appears in at most one part.A partition like “ababcbacadefegde”, “hijhklij” is incorrect, because it splits S into less parts. Solution 1: Greedy