#include <iostream>
#include <vector>
#include <unordered_map>
int main() {
std::vector<std::vector<std::string>> vec = {
{"c", "c++", "go"},
{"java", "c", "java"},
{"c++", "php", "javascript"}
};
std::unordered_map<std::string, int> freq;
for (const auto& row : vec) {
for (const auto& str : row) {
freq[str]++;
if (freq[str] > 1) {
std::cout << "Duplicate found: " << str << std::endl;
}
}
}
}
/*
run:
Duplicate found: c
Duplicate found: java
Duplicate found: c++
*/