classSolution{public:// Similar to 0242. Valid AnagramboolcanConstruct(stringransomNote,stringmagazine){vector<int>count(26);for(constcharc:magazine)++count[c-'a'];for(constcharc:ransomNote){if(count[c-'a']==0)returnfalse;--count[c-'a'];}returntrue;}};