#K84232. Anagram Word Formation
Anagram Word Formation
Anagram Word Formation
You are given two strings: letters
and word
. Your task is to determine whether the word
can be formed by using exactly all the letters in letters
once. In other words, check if the two strings are anagrams of each other.
Formally, let \( S \) be the string represented by letters
and \( T \) be the string represented by word
. You need to determine if:
[ \text{sorted}(S) = \text{sorted}(T) ]
If the condition holds, output Yes
; otherwise, output No
.
inputFormat
The input consists of two lines:
- The first line contains a string
letters
comprised of lowercase letters. - The second line contains a string
word
comprised of lowercase letters.
It is guaranteed that both strings have the same length.
outputFormat
Output a single line containing Yes
if word
can be formed by using all the letters from letters
exactly once. Otherwise, output No
.
arc
car
Yes