水题,数组开大点,就可以过了。
AC代码:
#include <iostream>
#include <cstring>
using namespace std;
char str1[100000], str2[200000];
int main()
{
// freopen("10340.txt", "r", stdin);
while(cin >> str1 >> str2)
{
int length1 = strlen(str1);
int length2 = strlen(str2);
int i, j;
for(i = 0, j = 0; i < length1 && j < length2; j++)
{
if(str1[i] == str2[j])
i++;
}
if(i == length1)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}