classSolution { public: boolcheckInclusion(strings1, strings2) { intn=s1.length(), m=s2.length(); if (n>m) { returnfalse; } vector<int>cnt1(26), cnt2(26); for (inti=0; i<n; ++i) { ++cnt1[s1[i] -'a']; ++cnt2[s2[i] -'a']; } if (cnt1==cnt2) { returntrue; } for (inti=n; i<m; ++i) { ++cnt2[s2[i] -'a']; --cnt2[s2[i-n] -'a']; if (cnt1==cnt2) { returntrue; } } returnfalse; } };