/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Accepted 1ms 320.0 KiB
#3 Accepted 1ms 324.0 KiB
#4 Accepted 1ms 324.0 KiB
#5 Accepted 1ms 532.0 KiB
#6 Accepted 1ms 532.0 KiB
#7 Accepted 1ms 532.0 KiB

Code

#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
bool isok(string s,string s1)
{
    int i=0,j=0;
    while (i<s.size()&& j<s1.size()) {
        if (s[i]==s1[j]) {
            j++;
        }
        i++;
    }
    return (j==s1.size());
}
int main()
{
    faster
    int t;
    cin >> t;
    while (t--) {
        string s,s1;
        cin >> s >> s1;
        if (isok(s,s1)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

Information

Submit By
Type
Submission
Problem
P1020 Favourite footballer
Contest
Brain booster - 1
Language
C++17 (G++ 13.2.0)
Submit At
2023-12-31 14:47:07
Judged At
2024-11-11 03:46:09
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB