Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<string>
- using namespace std;
- int main()
- {
- vector<string>a;
- string x;
- char y[100];
- int n,i,cnt,j;
- cin>>n;
- for(i=0;i<n;i++){
- cin>>x;
- scanf("%[^\n]",y);
- a.push_back(x);
- }
- sort(a.begin(),a.end());
- a.push_back("-1");
- i=0;
- cnt=1;
- while(i<a.size()-1){
- if(a[i]==a[i+1]){
- cnt++;
- i++;
- continue;
- }
- cout<<a[i]<<" "<<cnt<<endl;
- cnt=1;
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement