fork download
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4.  
  5. int main() {
  6. map<int, int> afk;
  7.  
  8. int dn[40] = {6, 1, 2, 1, 5, 3, 1, 0, 3, 1, 2, 3, 6, 2, 1, 1, 5, 5, 1, 5, 0, 1, 3, 0, 0, 1, 0, 2, 1, 0, 0, 3, 1, 5, 2, 1, 4, 1, 0, 3};
  9.  
  10. for(auto number : dn){
  11. afk[number]++;
  12. }
  13.  
  14. for(auto &p : afk){
  15. cout << p.first << " | " << p.second << endl;
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 5412KB
stdin
Standard input is empty
stdout
0 | 8
1 | 13
2 | 5
3 | 6
4 | 1
5 | 5
6 | 2