统计一字符串中个数最多的字符
2015-09-08 22:40
211 查看
#include"stdio.h" #include"string.h" //找出个数最多的字符 main(){ char str[50],*p1,*p2,*max_p; int count=0,maxcount=0; gets(str); p1=str; for(p1;*p1!='\0';p1++){ count=0; for(p2=p1;*p2!='\0';p2++){ if(*p1==*p2){ count++; } } if(count>maxcount){ maxcount=count; max_p=p1; } } printf("%c %d\n",*max_p,maxcount); }
相关文章推荐
- Oracle解锁的相关操作(转)
- 我们如何反思我们存在的世界
- Android Studio(三):设置Android Studio编码
- Vim 键盘映射
- Android Studio(三):设置Android Studio编码
- 使用VS2013分析DMP文件
- Android Studio(二):快捷键设置、插件安装
- js淡入淡出焦点图幻灯片效果代码分享
- MongoDB的安装与启动
- Android Studio(二):快捷键设置、插件安装
- java 集合
- hdu 4722 good numbers
- iOS 用Runtime解决服务器返回NSNull问题
- 在伙伴算法之前的内存管理机制
- wifi direct/p2p流程分析 基于android 5.1
- TextView+Fragment实现底部导航栏
- 测试的窘境
- TextView+Fragment实现底部导航栏
- 常微分方程的一个小推导
- Android Studio(一):介绍、安装、配置