poj1936 string处理

2019-11-09  本文已影响0人  暖昼氤氲
/*
Time:2019.11.9
Author: Goven
type:string查找子串 
err:
ref:
*/
#include<iostream>
#include<string> 
using namespace std;

int main()
{
    string s, t;
    int sl, tl, i, j;
    while (cin >> s >> t) {
        sl = s.length();
        tl = t.length();
        if (sl > tl) {
            cout << "No" << endl;
            continue;
        }
        for (i = 0, j = 0; i < sl && j < tl; ++j) {
            if (s[i] == t[j]) {
                ++i;
            }
        }
        if (i < sl) cout << "No" <<endl;
        else cout << "Yes" << endl;
    }
    
    return 0;
}


上一篇下一篇

猜你喜欢

热点阅读