Determine whether one string can be formed from another by deleting characters, and report the relationship between the two strings.
Problem Summary
You are given two strings. Your task is to determine whether the first string can be obtained from the second string by removing some characters without changing the order of the remaining characters.
If the first string is obtainable, you should also determine whether the first string is a proper suffix-structure of the second string in the sense that the second string contains it as a subsequence and has extra characters.
This is a classic string-processing task where you compare characters in order and track how much of the target string has been matched.
Notes
- Characters must remain in order.
- You may skip any number of characters in the source string.
- The two strings are not required to have the same length.
Input Format
The input format is not guaranteed from the provided metadata. For practice purposes, assume:
- A line containing string
s - A line containing string
t
where the task is to check whether s can be formed from t by deleting characters from t while preserving order.
Output Format
Print the required yes/no decision for the string relationship described in the problem statement. If multiple conditions are part of the task, print the corresponding classification requested by the statement.
Constraints
- Strings contain lowercase Latin letters unless otherwise specified.
- Lengths are small to moderate, suitable for linear scanning.
- Use an approach if checking subsequence compatibility.
Example 1
Input
abc a1b2c3
Output
YES
Explanation
The string abc appears in order inside a1b2c3 if we delete the digits.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.