#C1291. String Construction Challenge

    ID: 42389 Type: Default 1000ms 256MiB

String Construction Challenge

String Construction Challenge

In this problem, you are given two strings, s and t. Your task is to determine whether string s can be constructed from the characters in string t. Each character in t can be used at most once.

For each character ( x ) in s, we require that the frequency ( f_{s}(x) ) does not exceed the frequency ( f_{t}(x) ) in t. Formally, for all characters ( x ) in s, ( f_{s}(x) \leq f_{t}(x) ). If this condition holds, output "YES", otherwise output "NO".

inputFormat

The input consists of two lines:
1. The first line contains the string s.
2. The second line contains the string t.
Both strings consist only of lowercase English letters.

outputFormat

Output a single line which is either "YES" if string s can be constructed from string t using each character at most once, or "NO" otherwise.## sample

hello
lloeh
YES

</p>