Given n, which is the number of strings taken as input. For each input use have to print “YES” or “NO” whether the current string is already present or not.
Input:
5
Geeks
Hello
Great
Geeks
Hello
Output:
No
No
No
Yes
Yes
What I have tried:
bool isSubSequence(char str1[], char str2[], int m, int n)
{
if (m == 0) return true;
if (n == 0) return false;
if (str1[m-1] == str2[n-1])
return isSubSequence(str1, str2, m-1, n-1);
return isSubSequence(str1, str2, m, n-1);
}