字符串中最长子串
来源:互联网 发布:横道图绘制软件 编辑:程序博客网 时间:2024/05/16 17:29
#include <iostream>using namespace std;int fun(char *src,char *dst){char *p = src;char *s = NULL;int i = 0;int len = 0;int maxlen = 0;while(*p != '\0'){s = p;while((*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z') )s++;len = s - p;if(len > maxlen){maxlen = len;i = 0;while(p < s)dst[i++] = *p++;//总是保存最长子串dst[i]='\0';}elsep++;}return maxlen;}void main(){char *s = "12345ILOVECHINA123456AGOODCOMPANY321";char dst[100];int a = fun(s, dst);printf("%d\n%s\n", a, dst);}
0 0
- 字符串中最长子串
- 字符串中连续出现最长子串
- 字符串中连续最长重复子串
- 找出字符串中最长的子串
- 求字符串中最长回文子串
- 字符串中最长子串的问题
- 字符串中最长的数字子串
- 两个字符串中最长公共子字符串
- 字符串:最长回文子串
- 提取字符串最长子串
- 字符串查找最长子串
- 最长公共子串,字符串
- 【字符串】最长回文子串
- 字符串中连续出现最多的子串 & 字符串中最长重复子串
- 在字符串中查找最长重复子串的探讨
- 在一个字符串中查找最长回文子串
- 查找字符串中最长的连续数字子串
- 求S字符串中最长重复子串
- IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter notifyItemRangeRemove
- C++ 菱形继承问题 虚继承和虚基类
- 在Fedora 25中更换openjdk为oracle jdk
- Codeforces 667C Reberland Linguistics dp+set
- 1.Two Sum
- 字符串中最长子串
- CentOS 安装 SonaType Nexus Maven Repository以及旧库迁移
- Android Material Design之CoordinatorLayout
- java-监听器使用的例子
- linux sed 基本命令
- Spring 4.16: OpenSessionInViewFilter不起作用
- bzoj1895 Pku3580 supermemo splay
- JavaScript仿京东轮播图
- eclipse中tomcat启动后总是跳到servlets