1062 找子串


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

输入一些字串对,从第一个字串中找第二个字串。找到就说“Yes”,否则就说“No”。

Sample

Input

abcde a3
defsgbdffgfgbn dff

Output

No
Yes

Comments


  • 0
    sunspot  commented on March 5, 2026, 8:20 a.m.

    include<iostream>

    include<cstring>

    using namespace std; int main() { string a,b; while(cin>>a>>b) { int aa=a.length(),bb=b.length(),d=0; for(int i=0;i<=aa-bb;i++) { int c=1; for(int j=0;j<bb;j++) { if(a[i+j]!=b[j]) { c=0; break; } } if(c==1) { d=1,break; } } if(d)cout<<"Yes"<<endl; else cout<<"No"<<endl; } }