数算!

This commit is contained in:
rogerwang2008 committed 2026-10-16 10:21:53 +08:00
1 parent ca6daa582c
commit e0c09e0c7b
22 files changed
+1344 -105

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
#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;
}