/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Accepted 1ms 324.0 KiB
#3 Accepted 1ms 532.0 KiB
#4 Accepted 1ms 324.0 KiB
#5 Accepted 1ms 532.0 KiB
#6 Accepted 1ms 452.0 KiB
#7 Accepted 1ms 532.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-10-03 14:04:57
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB