Problem:


Score : 200 points

Problem Statement

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.

Notes

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:

N < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.

There exists i (1 \leq i \leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.

For example, xy < xya and atcoder < atlas.

Constraints

The lengths of s and t are between 1 and 100 (inclusive).

s and t consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

s
t

Output

If it is possible to satisfy s' < t', 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



Sample input:
yx
axy


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
n = input()
m = input()

flag = True

if len(n) < len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
elif len(n) == len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
else:
    for i in range(len(m)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
        

if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())

S = [ord(s) for s in S]
T = [ord(s) for s in T]

S.sort()
T.sort(reverse=True)

LS = len(S)
LT = len(T)

ok = False
for i in range(min(LS,LT)):
  s = S[i]
  t = T[i]
  if s < t:
    ok = True
    break
  elif s == t:
    continue
  elif t < s:
    ok = False
    break

if ok:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())

S = [ord(s) for s in S]
T = [ord(s) for s in T]

S.sort()
T.sort(reverse=True)

LS = len(S)
LT = len(T)

ok = False
for i in range(min(LS,LT)):
  s = S[i]
  t = T[i]
  if s < t:
    ok = True
    break
  elif s == t:
    continue
  elif t < s:
    ok = False
    break

if ok:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())

S = [ord(s) for s in S]
T = [ord(s) for s in T]

S.sort(reverse=True)
T.sort()

LS = len(S)
LT = len(T)

ok = False
for i in range(min(LS,LT)):
  s = S[i]
  t = T[i]
  if t < s:
    ok = True
    break
  elif s == t:
    continue
  else:
    ok = False
    break

if ok:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = input()
b = input()

a = sorted(a)
b = sorted(b,reverse=True)

N = len(a)
M = len(b)

can = False
i = 0

while i < N and i < M:
    if can == True:
        break

    if a[i] < b[i]:
        can = True
    elif a[i] == b[i] and  N < M and i== N:
        can = True
    i+=1

if can == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = input()
b = input()

a = sorted(a)
b = sorted(b,reverse=True)

N = len(a)
M = len(b)

can = False
i = 0

while i < N and i < M:
    if can == True:
        break

    if a[i] < b[i]:
        can = True
    elif a[i] == b[i] and  N < M:
        can = True
    i+=1

if can == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()

s_check = sorted(s)
t_check = sorted(t, reverse=True)

check_dict = {"t": t_check, "s": s_check, }
dict_sorted = sorted(check_dict.items(), key=lambda x: x[1])

if dict_sorted[0][0] == "s":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: <encoding name> -*-

s = input()
t = input()

print('Yes' if sorted(s) < sorted(t) else 'No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())

ss = sorted(list(ord(i) for i in s))
tt = sorted(list(ord(i) for i in t),reverse=True)

if len(s) < len(t):
    for i in range(len(s)):
        if ss[i] < tt[i]:
            print('Yes')
            exit()
        elif ss[i] > tt[i]:
            print('No')
            exit()
    print('Yes')
elif len(s) == len(t):
    for i in range(len(s)-1):
        if ss[i] < tt[i]:
            print('No')
            exit()
        elif ss[i] > tt[i]:
            print('Yes')
            exit()            
    if ss[-1] < tt[-1]:
        print('Yes')
        exit()
    print('No')
else:
    for i in range(len(t)):
        if ss[i] > tt[i]:
            print('No')
            exit()
        elif ss[i] < tt[i]:
            print('Yes')
            exit()
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = ''.join(sorted(list(input())))
T = ''.join(list(reversed(list(input()))))
if S < T:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()

##'間に挿入する文字列'.join([連結したい文字列のリスト])
s_sort = "".join(sorted(s))
t_sort = "".join(sorted(t,reverse=True))

print("yes" if s_sort < t_sort else "No")

Submission status: Wrong Answer

Solution code:
s = ''.join(sorted(list(input()), reverse=True))
t = ''.join(sorted(list(input()), reverse=True))

print('Yes') if s < t else print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()))

flag = False
if set(s) == set(t) and len(s) < len(t):
    flag = True
else:
    for i in range(min(len(s), len(t))):
        if ord(s[i]) > ord(t[i]):
            flag = True
            break

print('Yes') if flag else print('No')

Submission status: Wrong Answer

Solution code:
import sys
s = input()
t = input()

S = [s[i] for i in range(len(s))]
T = [t[i] for i in range(len(t))]
S.sort(reverse=True)
T.sort(reverse=True)

l = min(len(s), len(t))

for i in range(l):
    if S[i] < T[i]:
        print('Yes')
        sys.exit()
    if S[i] > T[i]:
        print('No')
        sys.exit()

if l == len(t):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s=sorted(input())
t=reversed(input())
ss=''.join(s)
tt=''.join(t)
print('YNeos'[ss>=tt::2])

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
s=sorted(s)
t=sorted(t,reverse=True)
s="".join(s)
t="".join(t)
if s>t:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
s=sorted(s)
t=sorted(s)
s="".join(s)
t="".join(t)
if s>t:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
# アルファベットから数値への変換
alpha2num = lambda c: ord(c) - ord('a') + 1

s = input()
t = input()

if s == t:
    print("No")
    exit()

s_indexs = []
t_indexs = []

for i in range(len(s)):
    s_indexs.append(alpha2num(s[i]))

for i in range(len(t)):
    t_indexs.append(alpha2num(t[i]))

s_indexs.sort()
t_indexs.sort(reverse = True)

len = min(len(s),len(t))
for i in range(len):
    if s_indexs[i] < t_indexs[i]:
        print("Yes")
        exit()
    elif s_indexs[i] > t_indexs[i]:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s2 = "".join(sorted(list(t)))
t2 = "".join(reversed(sorted(list(s))))
if s2 < t2:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
s.sort()
t = list(input())
t.sort()
print('Yes' if s< t else 'No')

Submission status: Wrong Answer

Solution code:
import random
s = list(input())
random.shuffle(s)
t = list(input())
random.shuffle(t)
''.join(s)
''.join(t)
print(s)
print(t)
print('Yes' if s< t else 'No')

Submission status: Wrong Answer

Solution code:
import random
s = list(input())
s_ = str(random.shuffle(s))
t = list(input())
t_ = str(random.shuffle(t))
print('Yes' if s_< t_ else 'No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())

S = sorted(s)
t = sorted(t, reverse=True)

if s<t:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
def main():
    s = sorted(input())
    t = sorted(input())

    S = ','.join(s)
    T = ','.join(t)

    if S < T:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s_=sorted(s)
t_=sorted(t,reverse=True)
A=[]
A.append(s_)
A.append(t_)
B=sorted(A)
if B[0]!=s_:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s_=sorted(s)
t_=sorted(t,reverse=True)
A=[]
A.append(s_)
A.append(t_)
B=sorted(A)
if B[0]==s_:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())

s_a = ''.join(sorted(s))
t_a = ''.join(sorted(t, reverse=True))

print(s_a, t_a)

if s_a < t_a :
    print('Yes')
else :
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())

s_a = ''.join(sorted(s))
t_a = ''.join(sorted(t, reverse=True))

print(s_a, t_a)

if s_a < t_a :
    print('Yes')
else :
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())

s_a = ''.join(sorted(s))
t_a = ''.join(sorted(t))

if s_a < t_a :
    print('Yes')
else :
    print('No')

Submission status: Wrong Answer

Solution code:
s=sorted(input())
t=sorted(input())
if s<t:
    ans="Yes"
else:
    ans="No"
print(ans)

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()), reverse = True)

Alpha = ['0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 
         'u', 'v', 'w', 'x', 'y', 'z']

while len(s) > len(t):
    t.append('0')


for i in range(len(s)+1):
    if i == len(s):
        print('Yes')
    elif Alpha.index(s[i]) < Alpha.index(t[i]):
        print('Yes')
        break
    elif Alpha.index(s[i]) > Alpha.index(t[i]):
        print('No')
        break
    else:
        continue

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()), reverse = True)

Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 
         'u', 'v', 'w', 'x', 'y', 'z']

while len(s) > len(t):
    t.append('a')


for i in range(len(s)+1):
    if i == len(s):
        print('Yes')
    elif Alpha.index(s[i]) < Alpha.index(t[i]):
        print('Yes')
        break
    elif Alpha.index(s[i]) > Alpha.index(t[i]):
        print('No')
        break
    else:
        continue

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()), reverse = True)

Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 
         'u', 'v', 'w', 'x', 'y', 'z']

for i in range(len(s)+1):
    if i == len(s):
        if len(t) > len(s):
            print('Yes')
        else:
            print('No')
    elif Alpha.index(s[i]) < Alpha.index(t[i]):
        print('Yes')
        break
    else:
        print('No')
        break

Submission status: Wrong Answer

Solution code:
s = sorted( list(input()) )
t = sorted( list(input()), reverse=True )

str_list = ["".join(s), "".join(t)]

sorted_str_list = sorted(str_list)

if str_list[0] == sorted_str_list[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s = sorted(s)
t = sorted(t,reverse=True)
flag = 0

for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
        flag = 1
        break

if len(s) < len(t) and s == t[:len(s)+1]:
    flag = 1

if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a=list(input())
b=list(input())
a.sort()
b.sort(reverse=True)

i=0
while i <= min(len(a), len(b))-1:
    if a[i] > b[i]:
        print('No')
        break     
    i+=1
else:
    if len(a)==len(b):
        print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
a=list(input())
b=list(input())
a.sort()
b.sort(reverse=True)

i=0
while i <= min(len(a), len(b))-1:
    if a[i] > b[i]:
        print('No')
        break     
    i+=1
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s = sorted(s)
t = sorted(t,reverse=True)
S = [ord(s[i]) for i in range(len(s))]
T = [ord(t[i]) for i in range(len(t))]
l = 0
if len(S) < len(T):
  for i in range(len(S)):
    if S[i] < T[i]:
      print('Yes')
      break
    elif S[i] >T[i]:
      print('No')
      break
    else:
      l += 1
  if l == len(S):
    print('Yes') 
else:
  for i in range(len(T)):
    if S[i] < T[i]:
      print('Yes')
      break
    elif S[i] >T[i]:
      print('No')
      break
    else:
      l += 1
  if l == len(S):
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ss = sorted(s)
tt = sorted(t,reverse=True)
for n, w in zip(ss,tt):
  if n < w:
    print("Yes")
    exit()
  elif n > w:
    print("No")
    exit()
if len(ss) > len(tt):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ss = sorted(s)
tt = sorted(t,reverse=True)
for n, w in zip(ss,tt):
  if n < w:
    print("Yes")
    exit()
if len(ss) > len(tt):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()

zisho = "abcdefghijklmnopqrstuvwxyz"

s_list = []
t_list = []

for i in range(len(s)):
  s_list.append(zisho.index(s[i])+1)
s_list.sort()
for i in range(len(t)):
  t_list.append(zisho.index(t[i])+1)
t_list.sort(reverse = True)

if len(s) > len(t):
  for i in range(len(s)-len(t)):
    t_list.append(0)
if len(t) > len(s):
  for i in range(len(t)-len(s)):
    s_list.append(0)

s_int = 0
t_int = 0

for i in range(len(s_list)):
  s_int = s_int + 100 ** (len(s)-i-1) * s_list[i]
  t_int = t_int + 100 ** (len(s)-i-1) * t_list[i]
  
if s_int < t_int: print('Yes')
else: print('No')

Submission status: Wrong Answer

Solution code:
# ABC082B

s = input()
t = input()
s = [ord(c) for c in sorted(s)]
t = [ord(c) for c in t]
ans = 'Yes'
for cs in s:
    candidate = []
    for ct in t:
        candidate.append(ct)
    if len(candidate) == 0:
        ans = 'No'
        break
    else:
        t.pop(t.index(candidate[0]))
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ss = ''.join(list(reversed(s)))
tt = ''.join(list(reversed(t)))
if ss < tt:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
ans = 'Yes'
n = min(len(s), len(t))
if s[:n] == t[:n]:
    if len(s) > len(t):
        ans = 'No'
else:
    for sc, tc in zip(s, t):
        if sc == tc:
            continue
        if sc > tc:
            ans = 'No'
        else:
            ans = 'Yes'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
ans = 'Yes'
if s == t:
    if len(s) <= len(t):
        ans = 'No'
else:
    for sc, tc in zip(s, t):
        if sc == tc:
            continue
        if sc > tc:
            ans = 'No'
        else:
            ans = 'Yes'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
T="".join(sorted(T, reverse=True))

if S<T:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=str(sorted(input()))
t=str(sorted(input(),reverse=True))
print('YNeos'[s>=t::2])

Submission status: Wrong Answer

Solution code:
s=list(input().rstrip())
t=list(input().rstrip())

s.sort()
t.sort()

if str(''.join(s))>=str(''.join(t)):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.reverse()
s="".join(s)
t="".join(t)
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = list(str(input()))
b = list(str(input()))
a.sort()
b.sort()
c = "".join(a)
d = "".join(b)
if c < d:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
jisho = "abcdefghijklmnopqrstuvwxyz"
s_num = []
t_num = []

for i in range(len(s)):
  s_num.append(jisho.index(s[i])+1)
for i in range(len(t)):
  t_num.append(jisho.index(t[i])+1)

if min(s_num) < max(t_num): print('Yes')
if max(s_num) < min(t_num): print('No')

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s_=str()
t_=str()
for i in range(len(s)):
    s_+=s[i]
for j in range(len(t)):
    t_+=t[j]
    
dic=[s_,t_]
dic.sort()
print("Yes" if dic[0]==s_ else "No")

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
S ="".join(sorted(S))
T="".join(sorted(T,reverse=True))
if S<=T:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
a = sorted(input())
b = sorted(input(), reverse=True)

if a <= b:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ans=0
s_t=set(s)&set(t)
S=sorted(list(set(s)-s_t))
T=sorted(list(set(t)-s_t))
if len(S)!=0 and len(T)!=0:
    if (S[0]<T[0]) :
        print("Yes")
    else:
        print("No")
elif len(S)==0 and len(T)!=0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s2=list(s)
t2=list(t)
s2_mojiretu="".join(sorted(s2))
t2_mojiretu="".join(reversed(t2))
if s2_mojiretu<t2_mojiretu:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s2=sorted(list(s))
t2=sorted(list(t))
s2_mojiretu="".join(reversed(s2))
t2_mojiretu="".join(reversed(t2))
if s2_mojiretu<t2_mojiretu:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s2=list(s)
t2=list(t)
s2_mojiretu="".join(reversed(s2))
t2_mojiretu="".join(reversed(t2))
if s2_mojiretu<t2_mojiretu:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def main():
    s = list(input())
    t = list(input())
    s = sorted(s)
    t = sorted(t)
    shrt = False
    for i in range(len(t)):
        if s[0] < t[i]:
            shrt = True
            break
    if shrt :
        print("Yes")
    else:
        print("No")
main()

Submission status: Wrong Answer

Solution code:
def main():
    s = list(input())
    t = list(input())
    s = sorted(s)
    t = sorted(t)
    print(s)
    print(t)
    shrt = False
    for i in range(len(t)):
        if s[0] < t[i]:
            shrt = True
            break
    if shrt :
        print("Yes")
    else:
        print("No")
main()

Submission status: Wrong Answer

Solution code:
a=sorted(list(input()))
b=sorted(list(input()))
if a[0]<b[-1]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def resolve():
    S = sorted(input())
    T = input()
    for s in S:
        if s in T:
            continue
        for t in T:
            if s < t:
                print("Yes")
                return
        print("No")
        return
    if len(S) < len(T):
        print("Yes")
    else:
        print("No")
            
        
            

if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:
a=sorted(input())
b=sorted(input())

if a[0]<=b[len(b)-1] and len(a)<len(b): 
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a=sorted(input())
b=sorted(input())

if a[0]<b[len(b)-1]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
print("YNeos"[s<t[::-1]::2])

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ss = ''.join(sorted(s))
tt = ''.join(sorted(t, reverse=True))
if ss > tt:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for i in range(len(s)):
    if i>len(t)-1:
        print('No')
        break
    elif s[i]>t[i]:
        print('No')
        break
    elif s[i]<t[i]:
        print('Yes')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
if len(s) < len(t):
    
    k = True
    for i in range(len(s)):
        if s[i] !=t[i]:k = False
    if k:print('Yes')
    else:print('No')
else:
    s.sort()
    t.sort(reverse = True)
    ok = "".join(s) < "".join(t)
    if ok:print('Yes')
    else:print('No')

Submission status: Wrong Answer

Solution code:
s=sorted(input())
t=sorted(input())
print("Yes" if s<t else "No")

Submission status: Wrong Answer

Solution code:
s = sorted(list(str(input())))
t = reversed(list(str(input())))
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Submission status: Wrong Answer

Solution code:
s = sorted(list(str(input())))
t = reversed(list(str(input())))
#s.sorted()
#t.reverse()
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Submission status: Wrong Answer

Solution code:
s = list(str(input()))
t = list(str(input()))
s.sort()
t.reverse()
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.reverse()
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.reverse()
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
if S<T:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.reverse()

S=''.join(map(str, s))
T=''.join(map(str, t))
if S<T:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.reverse()
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(list(str(input())))
t = sorted(list(str(input())))
S = str()
T = str()
for i in s:
    S += i
for k in range(1,len(T)):
    T += t[-k]
print('Yes' if S<T else 'No')

Submission status: Wrong Answer

Solution code:
a=list(input())
s=list(input())
ans=sorted(a)
ans1=sorted(s)
if ans<ans1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()

s = ''.join(sorted(s))
t = ''.join(sorted(t, reverse=True))

print(s, t)
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()

s = ''.join(sorted(s))
t = ''.join(list(reversed(t)))


if s<t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()

s = sorted(s)
t = list(reversed(t))

s = ''.join(s)
t = ''.join(t)
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# AtCoder
s = sorted(input())
t = sorted(input())
sr = sorted(s, reverse=True)
tr = sorted(t, reverse=True)

ans = 'No'
if (s[0] < t[0]) or (sr[0] < t[0]) or (s[0] < tr[0]) or (sr[0] < tr[0]):
    if len(s) < len(t):
        ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
# AtCoder
s = input()
t = input()

s = sorted(s)
t = sorted(t, reverse=True)
ans = 'No'
if s[0] < t[0]:
    ans = 'Yes'
print(ans)

Submission status: Wrong Answer

Solution code:
s="".join(sorted(list(input())))
t="".join(sorted(list(input()),reverse=True))

print("Yes" if [s,t]==sorted([s,t]) else "No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s=sorted(s,reverse=True)
t=sorted(t)
if s<t:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s=sorted(s)
t=sorted(t)
if s<t:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n, m = [sorted(list(input())) for i in range(2)]

flag = False
reverse = False
for i in range(min(len(n), len(m))):
  if n[i] < m[i]:
    flag = True
    break
  elif n[i] > m[i]:
    reverse = True
    break

if reverse:
  m = m[::-1]
  for i in range(min(len(n), len(m))):
    if n[i] < m[i]:
      flag = True
      break
    elif n[i] > m[i]:
        break
      
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
s = str(sorted(input()))
t = str(sorted(input())[::-1])
print('Yes' if s < t else 'No')

Submission status: Wrong Answer

Solution code:
s = str(sorted(input()))
t = str(sorted(input()))[::-1]
print('Yes' if s < t else 'No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
s = ''.join(s)
t = ''.join(t)

[print('Yes') if s < t else print('No')]

Submission status: Wrong Answer

Solution code:
a = list(input())
b = list(input())

a.sort()
b.sort(reverse=True)
f = [int(len(b)), int(len(a))]
e = min(f)
for i in range(int(e)):
    c =(a[i],b[i])
    d = sorted(c)
    if i != int(e)-1:
        if a[i] == b[i]:
            continue
        elif c == d and a[i] != b[i]:
            print("Yes")
            break
        else:
            print("No")
            break
    if i == int(e)-1:
        if a[i] == b[i]:
            if int(len(a)) >= int(len(b)):
                print("No")
            else:
                print("Yes")
        elif c == d and a[i] != b[i]:
            print("Yes")
            break
        else:
            print("No")
            break

Submission status: Wrong Answer

Solution code:
j = ''.join
s = sorted
i = input
l = [j(s(i())), j(s(i(), reverse=True))]
print(["No", "Yes"][l == s(l)])

Submission status: Wrong Answer

Solution code:
s=input()
t=input()

if sorted(s)[::-1]<sorted(t)[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(input())
t = sorted(input(), reverse=True)
N = len(s)
M = len(t)

def checker(i):
	while i < min(N,M):
		if s[i] < t[i]:
			return True
		if checker(i + 1):
			return True
		return False
	if N <= M:
		return True
	return False

if checker(0):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()

ss = "".join(sorted(s))
ts = "".join(sorted(t,reverse=True))

sortlist = sorted([ss,ts])

if sortlist[0] == ss:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s=sorted(input())
t=sorted(input())
if s<t:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
if str(sorted(s)) < str(sorted(t,reverse=True)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s=sorted(input())[::-1]
t=sorted(input())[::-1]
print('Yes' if s<t else 'No')

Submission status: Wrong Answer

Solution code:
base=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s=input()
t=input()

S=[]
T=[]


answer="No"

for i in s:
    S.append(base.index(i))
for j in t:
    T.append(base.index(j))
S=sorted(S)
T=sorted(T,reverse=True)

for k in range(min(len(S),len(T))):
    if S[k]>T[k]:
        answer="NO"
    elif S[k]<T[k]:
        answer="Yes"
if answer=="No" and len(S)<len(T):
    answer="Yes"
elif answer=="NO":
    answer="No"
print(answer)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

s = [ S[i] for i in range(len(S))]
t = [ T[i] for i in range(len(T))]

s.sort()
t.sort()
t.reverse()

for i in range(min(len(S),len(T))):
    if ord(s[i]) < ord(t[i]):
        print("Yes")
        exit(0)
    if ord(s[i]) > ord(t[i]):
        print("No")
        exit(0)

if len(S) <= len(T):
    print("Yes")
    exit(0)
else:
    print("No")
    exit(0)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)
ss = ''.join(s)
ts = ''.join(t)

if s < t:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())

s = list(map(ord,s))
t = list(map(ord,t))
s.sort()
t.sort(reverse=True)
for i in range(min(len(s),len(t))):
    if s[i] > t[i]:
        print('No')
        quit()
    elif s[i] < t[i]:
        break
if len(s) == len(t):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = input()
#print(n)
n = ''.join(sorted(n))

m = input()
#print(m)
m = ''.join(sorted(m))

#print(n)
#print(m)

if n < m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

s = input()
s_asc = ''.join(sorted(s))

t = input()
t_desc = ''.join(sorted(t, reverse=True))

if s_asc < t_desc:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

s=input()
t=input()

s="".join(sorted(s))
t="".join(sorted(t,reverse=True))

if s<t:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()

if s<t:
    print("Yes")
else:
    print("No")