Score : $200$ points
You are given strings $s$ and $t$, consisting of lowercase English letters. You will create a string $s'$ by freely rearranging the characters in $s$. You will also create a string $t'$ by freely rearranging the characters in $t$. Determine whether it is possible to satisfy $s' < t'$ for the lexicographic order.
For a string $a = a_1 a_2 ... a_N$ of length $N$ and a string $b = b_1 b_2 ... b_M$ of length $M$, we say $a < b$ for the lexicographic order if either one of the following two conditions holds true:
For example, xy $<$ xya and atcoder $<$ atlas.
Input is given from Standard Input in the following format:
$s$ $t$
If it is possible to satisfy $s' < t'$, print Yes; if it is not, print No.
yx axy
Yes
We can, for example, rearrange yx into xy and axy into yxa. Then, xy $<$ yxa.
ratcode atlas
Yes
We can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort $<$ tslaa.
cd abc
No
No matter how we rearrange cd and abc, we cannot achieve our objective.
w ww
Yes
zzz zzz
No