#include <iostream> #include <string> #include <map> #include <iterator> #include <cstdio> using namespace std; int main() { string s; int cnt=0; map<string,int> tree;//一对一映射 while(getline(cin,s)) { tree[s]++;//数组方式 cnt++; } map<string,int>::iterator iter; for(iter=tree.begin();iter!=tree.end();iter++) { cout<<iter->first; printf(" %.4f\n",iter->second*100.0/cnt); //cout<<iter->first<<' '<<fixed<<setprecision(4)<<iter->second*100.0/num*1.0<<endl; } return 0; }