#K95112. Subsequence Checker
Subsequence Checker
Subsequence Checker
Given two strings \(S_1\) and \(S_2\), determine whether \(S_2\) is a subsequence of \(S_1\). A subsequence is derived from a string by deleting some characters (possibly none) without changing the order of the remaining characters. For example, ace
is a subsequence of abcde
while aec
is not.
Your task is to print YES if \(S_2\) is a subsequence of \(S_1\), and NO otherwise.
Note: An empty string is considered a subsequence of any string.
inputFormat
The input consists of two lines:
- The first line contains the string \(S_1\).
- The second line contains the string \(S_2\).
outputFormat
Output a single line containing YES if \(S_2\) is a subsequence of \(S_1\), otherwise output NO.
## sampleabcde
ace
YES