字符统计
来源:互联网 发布:免费考勤软件 编辑:程序博客网 时间:2024/06/09 20:57
#include<bits/stdc++.h>using namespace std;struct Node{ char c; int cnt;}p,m[500];bool cmp(const Node&a,const Node&b) { if(a.cnt>b.cnt)return true; else if(a.cnt==b.cnt) { if(a.c<b.c)return true; else return false; } return false;}int main() { string a; while(getline(cin,a)!=NULL) { int Map[500]={0}; for(int i=0;i<a.size();i++) { Map[a[i]]++; } int num=0; for(int i=0;i<500;i++) { if(Map[i]!=0) { p.c=i; p.cnt=Map[i]; m[num++]=p; } } sort(m,m+num,cmp); for(int i=0;i<num;i++) cout<<m[i].c; cout<<endl; } return 0;}
阅读全文
0 0
- 字符统计
- 统计字符
- 统计字符
- 统计字符
- 统计字符
- 字符统计
- 字符统计
- 字符统计
- 字符统计
- 统计字符
- 统计字符
- 字符统计
- 统计字符
- 统计字符
- 字符统计
- 字符统计
- 字符统计
- 字符统计
- 我的程序员之路(英语的学习)
- PPT | 云客堂——基于云应用的公众号后台开发
- 输入整型数组和排序标识,对其元素按照升序或降序进行排序
- 英国CodaOctopus公司的Echoscope®实时3D声呐
- POJ 1408[Fishnet]题解
- 字符统计
- verilog 运算符
- 总结
- Python模拟浏览器前进后退操作
- 【Spring】Spring Framework Reference Documentation中文版22
- 快速排序
- Python模拟百度自动输入搜索功能
- Apache Beam开发指南
- BZOJ 2763: [JLOI2011]飞行路线 分层图最短路