Files
Data-Structure/std-Cpp/regex/UVA10340 子序列 All in All.cpp
2025-09-15 22:16:09 +08:00

25 lines
575 B
C++

#include <iostream>
#include <regex>
#include <string>
using namespace std;
int main() {
std::string s, t;
while (std::cin >> s >> t) {
std::string pattern;
for (char c : s) {
pattern += std::regex_escape(std::string(1, c)) + ".*";
}
// È¥µô×îºó¶àÓàµÄ .*
if (!pattern.empty()) pattern = pattern.substr(0, pattern.size() - 2);
std::regex re(pattern);
if (std::regex_match(t, re)) {
std::cout << "Yes\n";
} else {
std::cout << "No\n";
}
}
return 0;
}