Find subsequence

Given two strings A and B, find if A is a subsequence of B.

Return “YES” if A is a subsequence of B, else return “NO”.



Input Format

The first argument given is the string A.
The second argument given is the string B.

Output Format

Return "YES" if A is a subsequence of B, else return "NO". **Constraints**

1 <= lenght(A), length(B) <= 100000
'a' <= A[i], B[i] <= 'z'

For Example

Input 1:
    A = "bit"
    B = "dfbkjijgbbiihbmmt"
Output 1:
    YES

Input 2:
    A = "apple"
    B = "appel"
Output 2:
    "NO"
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Find subsequence on Interview Code Editor
Sign Up
to access hints and editorial solutions for Find subsequence

Discussion


Loading...
Click here to start solving coding interview questions