#K79517. String Transformation Checker
String Transformation Checker
String Transformation Checker
You are given two strings, a
and b
. Your task is to determine whether it is possible to obtain string b
by removing some (possibly zero) characters from string a
and rearranging the remaining characters. Formally, for every character \( c \) in b
, the number of occurrences of \( c \) in b
must be less than or equal to the number of occurrences of \( c \) in a
(i.e. \( \forall c: count_b(c) \le count_a(c) \)).
Output YES
if the transformation is possible, or NO
otherwise.
inputFormat
The input consists of two lines:
- The first line contains the string
a
. - The second line contains the string
b
.
Both strings consist of lowercase and/or uppercase English letters.
outputFormat
Output a single line containing YES
if string b
can be obtained from a
as described, and NO
otherwise.
programming
gamming
YES