hkshakib

Untitled

Mar 19th, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define pi acos(-1.0)
  4. //cout << fixed << setprecision(8) << a << endl;
  5. //cout << "Case " << ca << ": " << ans << endl;
  6. #define Fast_Input ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
  7. int main()
  8. {
  9. int t,j;
  10. cin >> t;
  11. getchar();
  12. for(j=1; j<=t; j++)
  13. {
  14. if(j!=0)
  15. cout<<endl;
  16. double c=0,i=0;
  17. map < string,int > m;
  18. string s;
  19. while(getline(cin,s) && s.length()!=0)
  20. {
  21. i++;
  22. m[s]++;
  23. }
  24.  
  25. for(auto x:m)
  26. {
  27. cout << x.first << " ";
  28. double y,z;
  29. z=x.second;
  30. y=((z*100)/i);
  31. cout << fixed << setprecision(4) << y << endl;
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment