Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <cstdio>
- #include <string>
- #include <cstring>
- using namespace std;
- int main() {
- int ncases;
- scanf("%d\n",&ncases);
- while(ncases--){
- map<string,int>m;
- int n=0;
- char s[35];
- while(gets(s) && strlen(s)!=0){
- m[s]++;
- n++;
- }
- for (map<string,int>::iterator it=m.begin(); it!=m.end(); it++)
- printf("%s %.4lf\n", (*it).first.data(), (double) (*it).second / (double) n * 100.0);
- if (ncases>0)
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment