题目链接:
http://poj.org/problem?id=1936
题目大意:
给定字符a,b,问b中去掉一些字符后能不能得到a
解题思路:
暴力从前往后扫描一遍即可。
AC代码:
/*** @description: poj1936水题* @author: michael ming* @date: 2019/6/25 17:35* @modified by: */
#include <string>
#include <iostream>
using namespace std;
int main()
{string a, b;size_t i, j;while(cin >> a >> b){for(i = 0, j = 0; i < a.size() && j < b.size(); ++j){if(a[i] == b[j])i++;}if(i == a.size())cout << "Yes" << endl;elsecout << "No" << endl;}return 0;
}