Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
bool validSub(string s1, string s2, int m, int n)
{
if (m == 0)
return true;
if (n == 0)
return false;
if (s1[m - 1] == s2[n - 1])
return validSub(s1, s2, m - 1, n - 1);
return validSub(s1, s2, m, n - 1);
}
int main()
{
int t;
cin >> t;
while (t--)
{
string s1, s2;
cin >> s2 >> s1;
int m = s1.size();
int n = s2.size();
validSub(s1, s2, m, n) ? cout << "YES" : cout << "NO" << endl;
}
return 0;
}
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:53:03
- Judged At
- 2024-11-11 03:46:07
- Judged By
- Score
- 0
- Total Time
- 2ms
- Peak Memory
- 576.0 KiB