Advertisement
Nita_Cristian

string

Feb 4th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int s[1001][1001], suma[1001], n, v[1001], k = 3, m = 2;
  6.  
  7. vector<string>text;
  8.  
  9. int main()
  10. {
  11.     freopen("test.in", "r", stdin);
  12.     freopen("text.out", "w", stdout);
  13.  
  14.     unordered_map<string, int>aparitii;
  15.     string propozitie;
  16.  
  17.     while(getline(cin, propozitie))
  18.     {
  19.         string cuvant;
  20.         stringstream linie(propozitie);
  21.         while(getline(linie, cuvant, ' '))
  22.         {
  23.             string nota = cuvant.substr(0, cuvant.length()-1);
  24.             aparitii[nota]++;
  25.         }
  26.     }
  27.     for(const auto it : aparitii)
  28.         cout << it.second << ' ';
  29.  
  30.     //map<string, pair<string, string> > dictionar;
  31.  
  32.     //dictionar["do"] = {"re","si"};
  33.     //dictionar.insert({"do", {"re","si"}});
  34.     //cout << dictionar["do"].first;
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement