第2关:预备实验:C++ STL进阶
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <string>
// 从标准输入读取一组字符串,存储在 vector 中
void readStrings(int n, std::vector<std::string> &strings) {
/********** 请在下面填写你的代码 **********/
for (int i = 0; i < n; ++i) {
std::string str;
std::cin >> str;
strings.push_back(str);
}
/********** 请在上面填写你的代码 **********/
}
// 使用 unordered_map 统计每个字符串出现的频率
void countFrequencies(const std::vector<std::string> &strings, std::unordered_map<std::string, int> &frequencies) {
/********** 请在下面填写你的代码 **********/
for (const auto &str : strings) {