#K50117. Beautiful String Checker
Beautiful String Checker
Beautiful String Checker
You are given an integer n, a list of n distinct lowercase English letters, and a string s. A string is considered beautiful if and only if it is a permutation of the given distinct letters, i.e., it satisfies the following conditions:
$$|s| = n$$ $$\{ s[i] : 0 \le i < n \} = \{a_1, a_2, \ldots, a_n\}$$
Your task is to check whether the string s is beautiful.
Example
For n = 3, distinct letters = [a, b, c] and s = "abc", the answer is YES because "abc" is a permutation of "a, b, c".
inputFormat
The input is given via standard input (stdin) and consists of three lines:
- The first line contains an integer n, the number of distinct letters.
- The second line contains n space-separated lowercase English letters.
- The third line contains the string s to be checked.
outputFormat
Print a single line to standard output (stdout) containing either "YES" if the string is beautiful, or "NO" otherwise.
## sample3
a b c
abc
YES