#include <iostream>
#include <unordered_map>
#include <vector>
int main()
{
std::vector<int> vec = { 2, 5, 3, 3, 5, 9, 1, 5, 7, 5, 5, 3 };
std::unordered_map<int, int> umap;
int len = vec.size();
for (int i = 0; i < len; i++) {
umap[vec[i]]++;
}
int max = 0;
for (auto pair: umap) {
std::cout << pair.first << " " << pair.second << std::endl;
if (pair.first > max) {
max = pair.first;
}
}
std::cout << "max : " << max << std::endl;
}
/*
run:
7 1
1 1
9 1
3 3
5 5
2 1
max : 9
*/