uva10340

    xiaoxiao2021-03-25  74

    题目:判断a串是不是b串的子串。 代码:

    #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<string> using namespace std; string s1,s2; int main() { while(cin>>s1>>s2) { int flag = 0; bool change; for(int i=0; i<s1.size(); i++) { change = false; for(int j=flag; j<s2.size(); j++) { if(s1[i]==s2[j]) { flag = j+1; change = true; break; } } if(!change) break; } if(change) printf("Yes\n"); else printf("No\n"); } return 0; }
    转载请注明原文地址: https://ju.6miu.com/read-36848.html

    最新回复(0)