find the longest numeric string in the given input strings
来源:互联网 发布:c语言高级实例解析 编辑:程序博客网 时间:2024/04/29 22:37
题目描述:对于一个输入的字符串,找出全是数字的最长的字符串
/*find teh longest numeric string */#include <stdio.h>#include <cytpe.h>int main(){ char* pos = NULL; int maxlen = -1; char* curpos = NULL; int curlen = 0; char str[30] = {0}; printf("input string\n"); scanf("%s",str); char *p = curpos = str; while(*p != 0) { if(!isdigit(*p)) { curlen = 0; curpos = p; curpos++; } else { curlen ++; if(curlen>maxlen) { maxlen = curlen; pos = curpos; } } p++; } if(maxlen) { printf("the logest numeric string is:\n"); for(int i=0;i<maxlen;i++) printf("%c",pos[i]); } else printf("no match result\n"); return 0;}
0 0
- find the longest numeric string in the given input strings
- Find the longest substring with k unique distinct characters in a given string (Google)
- 《牛客网leetcode144题》Given a string S, find the longest palindromic substring in S
- Find the Longest Word in a String
- Given a string, find the length of the longest substring without repeating characters
- freecodecamp学习--Find the Longest Word in a String
- leetcode Longest Substring Without Repeating Characters Description: Given a string, find the leng
- 代码面试题:Find the first element in a given string A that also appears in another given string B
- Write a function to find the longest common common string amongst an array of strings.
- Write a function to find the longest common prefix string amongst an array of strings.
- 4、Write a function to find the longest common prefix string amongst an array of strings
- Given an input string, reverse the string word by word.
- Given an input string, reverse the string word by word.
- Find the maximum subarray XOR in a given array
- Bonfire: Find the Longest Word in a String 找出一句话中最大的单词
- JavaScript实现-找出最长单词-Find the Longest Word in a String
- FCC算法:四、Find the Longest Word in a String -- 找出最长单词
- search the longest common substr in 2 strings
- 设计模式 组合模式 Composite
- Android Studio http proxy And SDK Manager代理设置
- Android 给点击事件加上水波纹
- window.location方法详解
- Makefile的使用
- find the longest numeric string in the given input strings
- 解决fastboot flash system system.img FAILED:data too large
- C++正则表达式
- M1 卡 FM1702sl读写
- 1124. Raffle for Weibo Followers 解析
- 带小数的String转整数Integer
- Elasticsearch Terms Aggregation 详解
- QTableWidget行选中/删除/添加行
- Ubuntu16.04 安装ActiveMQ