字符串求数字长度
来源:互联网 发布:北京 软件编程培训班 编辑:程序博客网 时间:2024/05/16 15:18
#include <stdio.h>#include <iostream>#include <cstring>#include <stdlib.h>#include <math.h>using namespace std;void outhanshu(char *str,int end,int max){ for(int j=end-max+1;j<=end;j++){ cout<<str[j]; }}int main(){ char str[1005]; while(cin.getline(str,1000)){ int length=strlen(str); int count=0; int max=0; int end=-1; for(int i=0;i<length;i++){ if(str[i]<='9'&&str[i]>='0'){ count++; if(max<count){ max=count; end=i; } } else{ count=0; } } if(max==0){ cout<<""; } else{ int count1=0; int end1=-1; for(int i=0;i<length;i++){ if(str[i]<='9'&&str[i]>='0'){ count1++; if(max==count1){ end1=i; outhanshu(str,end1,max); } } else{ count1=0; } } cout<<','; cout<<max<<endl; } } return 0;}
阅读全文
0 0
- 字符串求数字长度
- 求字符串中最长连续数字子串的长度
- 求一个字符串中的最大长度的数字
- 求字符串中最长连续数字子串的长度
- masm32 求字符串长度
- 宽字符串求长度
- 求字符串长度
- 求字符串的长度
- 字符串求长度
- 求字符串的长度
- sprintf,求字符串长度
- 汇编 求字符串长度
- 求字符串的长度
- 求字符串长度
- C++求字符串长度
- 求字符串长度
- 求string字符串长度
- 求字符串长度
- linux的进程基础
- 常用的ADB命令
- css中用list-style-type指定列表(lists)前面符号
- eventlet hub documents
- 从nginx-rtmp中提取一帧h264帧
- 字符串求数字长度
- GYM 100488 Toy Soldiers
- 日期转换
- 【转】并查集算法和路径压缩
- Android 图文混排
- MFC静态文本框重绘
- 单例模式和类加载的实际案例分析(java)
- linux设备驱动之ioctl控制
- Android 自定义PopupWindow7.0上的显示