Accepted
Code
#include <iostream>
#include <string>
using namespace std;
bool isSubsequence(string s, string t) {
int j = 0;
for (int i = 0; i < s.size() && j < t.size(); i++) {
if (s[i] == t[j]) {
j++;
}
}
return j == t.size();
}
int main() {
int t;
cin >> t;
while (t--) {
string S, N;
cin >> S >> N;
if (isSubsequence(S, N)) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1020 Favourite footballer
- Contest
- Brain booster - 1
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2023-12-31 15:59:11
- Judged At
- 2024-11-11 03:45:19
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 508.0 KiB