3-9 子序列 UVa 10340

#include <vector>
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	int j = 0;
	int k = 0;
	for (int i = 0; i < (int)t.size(); i++)
	{
		for (; j < (int)s.size(); j++)
			if (t[i] == s[j])
			{
				k++;
				break;
			}
	}
	if (k == t.size())
		cout << 1 << endl;
	else
		cout << 0 << endl;

	return 0;
}

猜你喜欢

转载自blog.csdn.net/fuwu4087/article/details/80382086