#include<iostream>#include<vector>classSolution{public:std::vector<int>partitionLabels(std::string s){int hash[26]{0};for(int i =0; i < s.size();++i)hash[s[i]-'a']= i;std::vector<int> result;int left =0, right =0;for(int i =0; i < s.size();++i){right = std::max(right, hash[s[i]-'a']);if(i == right){result.push_back(right - left +1);left = i +1;}}return result;}};intmain(){Solution s;return0;}