Wednesday, July 15, 2015

UVa 10340 - All in All

// UVa 10340 - All in All

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

int main() {

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

	return 0;
}

No comments:

Post a Comment