Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- cin>>t;
- cin.ignore();
- string s;
- getline(cin,s);
- for(int i=0; i<t; i++)
- {
- if(i!=0)
- cout<<endl;
- map<string, int>mp;
- map<string, int>:: iterator it;
- int cnt=0;
- while(getline(cin,s) && s.length()!=0)
- {
- cnt++;
- mp[s]++;
- }
- for(it=mp.begin(); it!=mp.end(); it++)
- {
- cout<<it->first<<" "<<fixed<<setprecision(4)<<(double)(it->second*100)/cnt<<endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement