#abc082b. [abc082_b]Two Anagrams
[abc082_b]Two Anagrams
Problem Statement
You are given strings and , consisting of lowercase English letters. You will create a string by freely rearranging the characters in . You will also create a string by freely rearranging the characters in . Determine whether it is possible to satisfy for the lexicographic order.
Notes
For a string of length and a string of length , we say for the lexicographic order if either one of the following two conditions holds true:
- and , , ..., .
- There exists () such that , , ..., and . Here, letters are compared using alphabetical order.
For example, xy
xya
and atcoder
atlas
.
Constraints
- The lengths of and are between and (inclusive).
- and consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to satisfy , print Yes
; if it is not, print No
.
Sample Input 1
yx
axy
Sample Output 1
Yes
We can, for example, rearrange yx
into xy
and axy
into yxa
. Then, xy
yxa
.
Sample Input 2
ratcode
atlas
Sample Output 2
Yes
We can, for example, rearrange ratcode
into acdeort
and atlas
into tslaa
. Then, acdeort
tslaa
.
Sample Input 3
cd
abc
Sample Output 3
No
No matter how we rearrange cd
and abc
, we cannot achieve our objective.
Sample Input 4
w
ww
Sample Output 4
Yes
Sample Input 5
zzz
zzz
Sample Output 5
No