![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/56131244d066d8f3a2e3e5ef14513d71.png)
string countAndSay(int n) {
string s = "1";
for(int i = 0; i < n-1; i ++){
string ns = "";
for(int j = 0; j < s.size(); j ++){
int k = j;
while(k < s.size() && s[k] == s[j]) k ++;
ns += to_string(k - j);
ns += s[j];
j = k - 1;
}
s = ns;
}
return s;
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7886d35d298902cb1380cf9610f7e4e1.png)
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string,vector<string>> hash;
for(auto s : strs){
string key = s;
sort(key.begin(),key.end());
hash[key].push_back(s);
}
vector<vector<string>> ans;
for(auto item : hash){
ans.push_back(item.second);
}
return ans;
}