class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param s string字符串 
     * @return int整型vector
     */
    vector<int> partitionLabels(string s) {
        // write code here
        vector<int> ret;
        unordered_set<char> se;
        for (int i = 0; i < s.size(); ++i)
        {
            int count = 1;
            for (int j = i + 1; j < s.size(); ++j)
            {
                if (se.find(s[j]) != se.end() || s[j] == s[i])
                {
                    int tmp = i;
                    while (tmp <= j)
                        se.insert(s[tmp++]);
                    count += j - i;
                    i = j;
                }
            }
            ret.push_back(count);
        }
        return ret;
    }
};