#K1911. Taco Transformation
Taco Transformation
Taco Transformation
Given two strings s1 and s2, determine whether s1 can be transformed into s2 by deleting some characters from s1 and rearranging the remaining characters.
This is equivalent to checking if for every character \( c \), the frequency in s1 is at least as high as its frequency in s2, i.e., \[ n_{s1}(c) \ge n_{s2}(c) \quad\text{for all } c \]
If the condition holds, output YES
; otherwise, output NO
.
inputFormat
The input is provided via standard input (stdin) and consists of two lines:
- The first line contains the string s1.
- The second line contains the string s2.
outputFormat
Output a single line to standard output (stdout) with either YES
if s1 can be transformed into s2 according to the rules, or NO
otherwise.
apple
ple
YES