18.验证子串
来源:互联网 发布:爱淘宝1元红包抽不中 编辑:程序博客网 时间:2024/06/16 10:49
输入两个字符串,验证其中一个串是否为另一个串的子串。
否则,若第二个串s2是第一个串s1的子串,输出(s2) is substring of (s1)
否则,输出 No substring。
abcdddncabca
abc is substring of dddncabca
#include <stdio.h>
#include <string.h>
#define N 200
char A[N], B[N];
int main()
{
char *r1,*r2;
scanf("%s %s",A,B);
r1=strstr(B,A);
r2=strstr(A,B);
if(r1!=NULL)
printf("%s is substring of %s\n", A, B);
else if (r2 != NULL)
printf("%s is substring of %s\n", B, A);
else
printf("No substring\n");
return 0;
}
阅读全文
0 0
- 18.验证子串
- 验证子串
- 18:验证子串
- 验证子串
- noi-8176-验证子串
- 字符串练习18_验证子串
- 设计一个字符串子串删除函数 将结果子串指针返回 用主程序验证
- 密码验证合格程序(判断字符串是否有重复子串)
- 子串
- 子串
- 子串
- 子串
- 子串
- 子串
- 子串
- 子串
- 子串
- 子串
- ActiveMQ消息中间件学习(一)
- ActiveMQ安装
- MindManager 2018中文破解版免费下载安装教程
- 万树IT:软件测试必备网络知识
- 从github上下载的项目无法在androidstudio中打开的解决方法
- 18.验证子串
- 使用Scrapy爬取CSDN博客首页文章
- 怎样设置Apache访问限制(根据目录、url路径等条件限制)
- java心得(IO)
- JS截取字符串常用方法详细整理
- git : Please move or remove them before you can merge
- Visual Basic 的远程特性
- ubuntu16.04安装teamviewer12依赖包解决
- 浅谈《排列组合》