21 lines
493 B
C++
21 lines
493 B
C++
#include <iostream>
|
|
|
|
bool is_within(const std::string& str, const std::string& substr) {
|
|
int i = 0, j = 0;
|
|
for (; i < str.size() && j < substr.size(); i++) {
|
|
if (str[i] == substr[j]) { j++; }
|
|
}
|
|
return j == substr.size();
|
|
}
|
|
|
|
int main() {
|
|
std::ios::sync_with_stdio(false);
|
|
std::cin.tie(nullptr);
|
|
std::string substr, str;
|
|
while (std::cin >> substr >> str) {
|
|
std::cout << (is_within(str, substr) ? "Yes" : "No") << std::endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|