Advertisement
hkshakib

Untitled

Mar 19th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t;
  6. cin>>t;
  7. cin.ignore();
  8. string s;
  9. getline(cin,s);
  10. for(int i=0; i<t; i++)
  11. {
  12. if(i!=0)
  13. cout<<endl;
  14. map<string, int>mp;
  15. map<string, int>:: iterator it;
  16. int cnt=0;
  17. while(getline(cin,s) && s.length()!=0)
  18. {
  19. cnt++;
  20. mp[s]++;
  21. }
  22. for(it=mp.begin(); it!=mp.end(); it++)
  23. {
  24. cout<<it->first<<" "<<fixed<<setprecision(4)<<(double)(it->second*100)/cnt<<endl;
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement