The given subsequence is present in the given string or not
Problem to find the given subsequence is present in the given string or not.
Example-1:
Input : s1 = "ran" s2 = "mycrazycoding" Output : Yes
Example-2:
Input : s1 = "word" s2 = "hello world" Output : Yes
Example-3:
Input : s1 = "run" s2 = "mycrazycoding" Output : No
Solution
s1 = "ran" s2 = "mycrazycoding" d = "" for i in range(len(s2)): for j in range(len(s1)): if(s2[i]==s1[j]): d += s2[i] if(s1 in d): print("Yes") else: print("No")
Output
Yes