uva10340子序列

/*判断是否可以从字符串t中删除0或多个字符得到字符串s,如ac属于abcd。*/

 string s, t;
    while (cin >> s >> t) {
        unsigned int i = 0, j = 0;
        while (i < s.length() && j < t.length()) {
            if (s[i] == t[j]) {
                ++i;
                ++j;
            } else {
                ++j;
            }
        }
        cout << (i == s.length() ? "Yes\n" : "No\n");
    }

 

posted @ 2020-10-29 21:04  __小王子  阅读(59)  评论(0)    收藏  举报