/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Accepted 2ms 344.0 KiB
#3 Accepted 2ms 332.0 KiB
#4 Accepted 2ms 508.0 KiB
#5 Accepted 3ms 324.0 KiB
#6 Accepted 2ms 492.0 KiB
#7 Accepted 2ms 328.0 KiB

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