Subsequence
InterviewTime limit1sMemory limit128 MB
For each line of input, decide whether the first string is a subsequence of the second, printing Yes or No.
- Level
Easy3 of 10
- Topics
- Two pointers, String, Greedy, Implementation
- Solved
- No attempts yet
Problem
You are given two strings and . Write a program that decides whether is a subsequence of . Here, is a subsequence of if you can delete some characters of and concatenate the remaining characters, without reordering them, to obtain . In other words, every character of appears in in the same relative order (they need not be contiguous).
Input
The input consists of several test cases. Each test case is a single line containing two strings and separated by a single space. Each string has length at most 100,000. The input continues until end of file (EOF).
Output
For each test case, print Yes on its own line if is a subsequence of , and No otherwise.