字符串包含-strstr

题号: 10247
时限:1000ms
限制内存:32768KB
题目: 字符串包含判断

描述

给定两个字符串a,b。问在a中是否包含b,如果包含则输出yes,否则输出no。
输入格式

一行两个字符串,使用空格分开。
输出格式

yes或者no,如题。
输入样例

abccd bcc
输出样例

yes
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    char a[10000],b[10000];
    cin>>a>>b;
    if(strstr(a,b)!=NULL)
    cout<<"yes";
    else cout<<"no";
    return 0;
}

猜你喜欢

转载自blog.csdn.net/gz153016/article/details/80406592