partitionLabels = function(S) {
    const lastSeen = getLast(S);

    return getAns(S, lastSeen);
}
https://leetcode.com/problems/partition-labels/
Time O(N) | Space(1)
@param {string} S
@return {number[]}