D_L3

SDA - 2021-2022 - test5 - task 1

Dec 11th, 2023
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <unordered_map>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.     vector<string> strs;
  12.     unordered_map<string, int> counter;
  13.     int n;
  14.     string word;
  15.     cin >> n;
  16.  
  17.     for(int i = 0; i < n; i++){
  18.         cin >> word;
  19.         strs.push_back(word);
  20.         counter[word]++;
  21.     }
  22.    
  23.     for(string i : strs){
  24.         cout << counter[i] << " ";
  25.     }
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment