Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<cstdio>
- using namespace std;
- int main()
- {
- map<string,int> mp;
- double cnt,temp;
- int t;
- string tree;
- cin>>t;
- getchar();
- getchar();
- while(t--)
- {
- cnt=0.0;
- while(1)
- {
- getline(cin,tree);
- if(tree=="")
- {
- break;
- }
- else
- {
- cnt++;
- mp[tree]++;
- }
- }
- map<string,int>:: iterator it;
- for(it = mp.begin();it!=mp.end();it++)
- {
- temp = it->second;
- cout<<it->first<<" ";
- printf("%.4lf\n",(temp/cnt)*100);
- }
- if(t>0)
- {
- cout<<endl;
- mp.clear();
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement