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

Solution (Python):
def main(I):
    
    I[0].sort()
    I[1].sort(reverse = True)
    if str(I[0]) == str(I[1]):
        return False
    else:
        return str(I[0]) == str(sorted(I)[0])

I = list(list(input()) for _ in range(2))
print("Yes" if main(I) else "No")

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

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

ans=sorted([s,t])

if ans[0] == s and s!=t:
    print("Yes")
else:
    print("No")

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

s.sort()
t.sort(reverse=True)

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

Solution (Python):
def main():
    s = list(input())
    t = list(input())
    
    s.sort()
    t.sort(reverse=True)
    
    if ''.join(s) < ''.join(t):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

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

s.sort()
t.sort(reverse=True)

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

Solution (Python):
s=input()
t=input()
slist=[s[i] for i in range(len(s))]
tlist=[t[i] for i in range(len(t))]
slist.sort()
tlist.sort(reverse=True)
s_new=""
t_new=""
for i in range(len(slist)):
  s_new += slist[i]
for i in range(len(tlist)):
  t_new += tlist[i]
if s_new < t_new:
  print("Yes")
else:
  print("No")

Solution (Python):
s="".join(sorted(input()))
t="".join(sorted(input())[::-1])
print("Yes" if s<t else "No")

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

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

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

Solution (Python):
a = list(input())
b = list(input())
a.sort()
b.sort(reverse = True)
if a < b:
  print("Yes")
else:
  print("No")

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

s = sorted(s)
t = sorted(t)
t = t[::-1]

s_ = ''
t_ = ''

for i in s:
    s_ += i
for j in t:
    t_ += j

if s_ < t_:
    print("Yes")
else:
    print("No")

Solution (Python):
a = list(input())
b = list(input())
a.sort()
b.sort(reverse = True)
if a < b:
  print("Yes")
else:
  print("No")

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

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

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

print("YNeos"[t <= s::2])

Solution (Python):
s_min = sorted(input())
t_max = sorted(input())[::-1]
print("Yes" if s_min < t_max else "No")

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

Solution (Python):
chrdict = {}
for i, c in enumerate(range(97, 123), start=1):
    chrdict[chr(c)] = i
src1 = input()
src2 = input()
dst1, dst2 = [], []
for i in range(len(src1)):
    dst1.append(chrdict[src1[i]])
for i in range(len(src2)):
    dst2.append(chrdict[src2[i]])
dst1.sort()
dst2.sort(reverse=True)
dsted1 = 0
dsted2 = 0
maximum = max([len(dst1), len(dst2)])
for d1, d2 in zip(dst1, dst2):
    if d1 == d2:
        continue
    else:
        dst = "Yes" if d1 < d2 else "No"
        break
else:
    dst = "Yes" if len(src1) < len(src2) else "No"
print(dst)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    t=STR()
    s=sorted(s)
    t=sorted(t,reverse=True)
    
    flg=0
    ct=min(len(s),len(t))
    for i in range(ct):
        if flg==1 or flg==2:
            break
        if s[i]<t[i]:
            flg=1
        elif s[i]>t[i]:
            flg=2
    if flg==0:
        if len(s)>=len(t):
            flg=2
        else:
            flg=1
    if flg==1:
        print('Yes')
    else:
        print('No')
        
    
if __name__ == '__main__':
    do()

Solution (Python):
import sys

s=input()
t=input()
s_list=[]
t_list=[]
for i in range(len(s)):
	s_list.append(s[i])
for j in range(len(t)):
	t_list.append(t[j])
s_list.sort()
t_list.sort(reverse=True)
print("Yes" if s_list<t_list else "No")

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

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

print("Yes" if si < ti else "No")

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

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

S_str = "".join(S)
T_str = "".join(T)

if S_str < T_str:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
s=str(input())
t=str(input())
ss=sorted(s)
tt=sorted(t, reverse=True)
if ss < tt:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
t=input()
flag=0
l1=list(s)
l2=list(t)
l1.sort()
l2.sort(reverse=True)

minlen=min(len(l1),len(l2))
for i in range(minlen):
    if (l1[i]<l2[i]):
        flag=1
        break
    if (l1[i]>l2[i]):
        flag=-1
        break

if flag==0:
    if (len(l1)<len(l2)):
        flag=1
    else:
        flag=-1
if flag==1:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
s = sorted(readline().rstrip())
t = sorted(readline().rstrip())[::-1]
print("Yes" if s < t else "No")

Solution (Python):
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s, t = read().decode('utf8').split()
S=''.join(sorted(s))
T=''.join(sorted(t))

print('Yes' if S < T[::-1] else 'No')

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


sd=sorted(s)
td=sorted(t,key=lambda x:x[-1], reverse=True)


if sd < td:
    print('Yes')
else:
    print(('No'))

Solution (Python):
s=input()
s_sorted=''.join(sorted(s))
t=input()
t_sorted_rev=''.join(sorted(t, reverse=True))
if s_sorted<t_sorted_rev:
    print('Yes')
else:
    print('No')

Solution (Python):
print("Yes" if sorted(input())<sorted(input())[::-1] else "No")

Solution (Python):

s = input()
t = input()
list_s = []
list_t = []
for i in range(len(s)):
    list_s.append(s[i])
for i in range(len(t)):
    list_t.append(t[i])
list_s.sort()
list_t.sort()
for i in range(len(s)):
    if list_s[i] < list_t[-i-1]:
        print("Yes")
        exit(0)
    elif list_s[i] > list_t[-i-1]:
        print("No")
        exit(0)
    elif i == len(t)-1:
        if i < len(s):
            print("No")
        else: print("Yes")
        exit(0)
print("Yes")

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if s < t:
    print("Yes")
else:
    print("No")

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

if s >= t:
  print("No")
else:
  print("Yes")

Solution (Python):
x, y = (str(input()) for i in range(2))
print("Yes" if "".join(sorted(x))<"".join(sorted(y, reverse=True)) else "No")

Solution (Python):
s = input()
t = input()
s=sorted(s)
t=sorted(t, reverse=True)
s2 = "".join(s)
t2 = "".join(t)
if s2<t2:
    print("Yes")
else:
    print("No")

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

s.sort()
t.sort(reverse=True)
if s == t:
    print("No")
    exit()
S = ""
T = ""
for i in s:
    S += i
for i in t:
    T += i

lst1 = [S,T]
lst2 = lst1[:]

lst2.sort()

if lst1 == lst2:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()
sl = list(s)
tl = list(t)
sl_asc = sorted(sl)
tl_desc = sorted(tl, reverse=True)
s2 = ''.join(sl_asc)
t2 = ''.join(tl_desc)
if s2 < t2:
  print("Yes")
else:
  print("No")

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

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

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

Solution (Python):
s = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()), reverse=True))
print('Yes') if s<t else print('No')

Solution (Python):
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')

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

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

Solution (Python):
s = list(str(input()))
t = list(str(input()))

s_sorted = sorted(s)
t_sorted = sorted(t, reverse=True)

ans = -1
for i in range(min(len(s), len(t))):
    if s_sorted[i] < t_sorted[i]:
        ans = 1
        break
    elif s_sorted[i] > t_sorted[i]:
        ans = 0
        break
    else:
        continue

if ans == -1:
    if len(s) < len(t):
        ans = 1
    else:
        ans = 0

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

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

Solution (Python):



s = "".join(sorted(list(input())))

t = "".join(sorted(list(input()), reverse=True))

ans = "Yes" if s < t else "No"

print(ans)

Solution (Python):
s = input()
t = input()
S = sorted(s)
T = sorted(t, reverse=True)
if S < T:
  print("Yes")
else:
  print("No")

Solution (Python):
S = str(input())
T = str(input())
S=sorted(S)
T=sorted(T, reverse=True)
if S < T:
    print("Yes")
else:
    print("No")

Solution (Python):
print("Yes" if sorted(input())<sorted(input())[::-1] else "No")

Solution (Python):
s = sorted(input())
t = sorted(input())

t = t[::-1]

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

Solution (Python):
s="".join(sorted(list(input())))
t="".join(sorted(list(input()),reverse=True))
if s==t:
  print("No")
elif tuple(sorted([s,t]))==(s,t):
  print("Yes")
else:
  print("No")

Solution (Python):
A=input()
B=input()
RA=''.join(sorted(A))
RB=''.join(sorted(B)[::-1])
if RA < RB:
  print('Yes')
else:
  print('No')

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

Solution (Python):
s = input()
t = input()
s_list = sorted(s)
t_list = sorted(t, reverse=True)
s_new = "".join(s_list)
t_new = "".join(t_list)
if s_new < t_new:
    print("Yes")
else:
    print("No")

Solution (Python):
s, t = "".join(sorted(input())), "".join(sorted(input(), reverse=True))
print("YNeos"[s>=t::2])

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

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

asc_s = "".join(sorted(s))

desc_t = "".join(sorted(t,reverse = True))
                 
if asc_s < desc_t:
                 print("Yes")
else:
                 print("No")

Solution (Python):
s = list(input())
t = list(input())
s.sort(), t.sort(reverse=True)
s, t = ''.join(s), ''.join(t)

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

Solution (Python):
def main():
    s = input()
    t = input()

    s = list(s)
    t = list(t)

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

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

if __name__ == '__main__':
    main()

Solution (Python):


import numpy as np

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

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

Solution (Python):


import numpy as np

s=sorted(input())
t=sorted(input())
t.reverse()

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

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


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

Solution (Python):
s=input()
t=input()
s_l,t_l=[],[]
for i in s:
	s_l.append(i)
for i in t:
	t_l.append(i)
s_l.sort()
t_l.sort(reverse=True)
s="".join(s_l)
t="".join(t_l)
if s<t:
	print("Yes")
else:
	print("No")

Solution (Python):
s = input()
t = input()
s_sort = "".join(sorted(s))
t_sort = "".join(sorted(t)[::-1])
if s_sort < t_sort:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()

t=input()

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

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




























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

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


def judge(s, t):
    s = sorted(s)
    t = sorted(t)[::-1]
    N = len(s)
    M = len(t)

    org_t = sorted(t)
    if s == org_t:
        return False

    if N < M and s[:N] == org_t[:N]:
        return True

    min_len = min(N, M)
    for a, b in zip(s[:min_len], t[:min_len]):
        if a == b:
            continue
        return a < b
    
    return False


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

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


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

s = "".join(S)
t = "".join(T)
if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
str1 = input()
str2  = input()

if str1 == str2:
	print('No')
else:
	arr1 = [ ord(s) for s in str1 ]
	arr2 = [ ord(s) for s in str2 ]

	
	arr1.sort()
	arr2.sort(reverse=True)

	flag = True
	for s, t, in zip(arr1, arr2):
		if s == t:
			continue
		else:
			if t > s:
				flag = False
				print('Yes')
				break
			else:
				flag = False
				print('No')
				break
	
	if flag:
		if len(arr1) > len(arr2):
			print('No')
		else:
			print('Yes')

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

s.sort()
t.sort(reverse=True)

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

Solution (Python):
a = sorted(input())
b = sorted(input(), reverse=True)
print('Yes' if a < b else 'No')

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

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

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
ans = "No"
T = min(len(s),len(t))
for i in range(T) :
    if s[i] < t[i] :
        ans = "Yes"
        break
count = 0
for i in range(T) :
    if s[i] > t[i] :
        break
    if s[i] == t[i] :
        count+=1
if count == T and len(t) > len(s) :
    ans = "Yes"
print(ans)

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

s.sort()
t.sort(reverse=True)

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

for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print('Yes')
        exit()
    elif s[i] > t[i]:
        print('No')
        exit()
  
if ''.join(t) in ''.join(s):
    print('No')
else:
    print('Yes')

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




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

if s_dash < t_dash:
    print('Yes')
else:
    print('No')

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

if ''.join(sorted(s)) < ''.join(sorted(t,reverse=True)):
  print('Yes')
else:
  print('No')

Solution (Python):



yes = "Yes"
no = "No"

def solver(sStr,tStr):
    ssStr = ''.join(sorted(sStr))
    srtStr = ''.join(sorted(tStr,reverse=True))
    result = yes if ssStr < srtStr else no
    return result

if __name__ == "__main__":
    s = input()
    t = input()
    answer = solver(s,t)
    print(answer)

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

s.sort()
t.sort(reverse=True)

''.join(s)
''.join(t)

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

Solution (Python):
s = list(input())
s.sort()
s = "".join(s)

t = list(input())
t.sort(reverse=True)
t = "".join(t)

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

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

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

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

if sorted_s < sorted_t:
  print('Yes')
else:
  print('No')

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

s.sort()
t.sort(reverse=True)

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

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

i = 0
ans = False

while i < len(a) and i < len(b):
  if a[i] != b[i] :
    if a[i] > b[i]:
      ans = False
    else:
      ans = True
    break
  i += 1
else:
  if len(a) < len(b):
    ans = True
  
if ans:
  print("Yes")
else:
  print("No")

Solution (Python):

S = str(input())
T = str(input())
S = "".join(sorted(S))
T = "".join(sorted(T))
T = T[::-1]
ST = sorted([S,T])

if (ST[0]==S and S!=T):
    print ("Yes")
else:
    print ("No")

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

Solution (Python):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
a=""
b=""
for i in range(len(s)):
    a+=(s[i])
for i in range(len(t)):
    b+=(t[i])

c=sorted([a,b])
if c[1]==a:
    print("No")
else:
    print("Yes")

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

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

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

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

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

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

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

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

Solution (Python):


s_list = list(input())
t_list = list(input())

s_list.sort()
t_list.sort(reverse=True)

_s = ''.join(s_list)
_t = ''.join(t_list)

if _s < _t:
    print('Yes')
else:
    print('No')

Solution (Python):

s=input()
t=input()
min_len=min(len(s),len(t))
slist=sorted(s)
tlist=sorted(t)
tlist.reverse()
for i in range(min_len):
    x=ord(slist[i])
    y=ord(tlist[i])
    if(x<y):
        print("Yes")
        exit()
if(slist[:len(s)]==tlist[:len(s)] and len(s)!=len(t)):
    print("Yes")
    exit()
print("No")

Solution (Python):
import sys

s = input()
t = input()


lists = [_ for _ in s]
listt = [_ for _ in t]



for i in range(0,len(s)):
    for j in range(0, len(t)):
        if s[i]<t[j]:
            print('Yes')
            sys.exit()

lists.sort()
listt.sort()

if len(lists)<len(listt) and lists[0:len(lists)]==listt[0:len(lists)]:
    print('Yes')
    sys.exit()

print('No')

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

s_r = sorted(s)
t_r = sorted(t, reverse=True)

if s_r < t_r:
    print("Yes")
else:
    print("No")

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

if(s == t):
  print("No")
  
else:
  cnt = "No"
  
  
  s_sort = sorted(s)
  
  
  
  t_sort_rev = sorted(t, reverse=True)
  
  min_len = min( len(s), len(t) )
  if( len(s) < len(t) ):
    
    s_more_length = False
  elif( len(s) > len(t) ):
    
    s_more_length = True
  
  
  for i in range ( min_len ):
    if( ord(s_sort[i]) < ord(t_sort_rev[i]) ):
      cnt = "Yes"
      break
    elif( ord(s_sort[i]) == ord(t_sort_rev[i])):
      
      if( i == min_len-1 and s_more_length == False ):
        cnt = "Yes"
      elif( i == min_len-1 and s_more_length == True ):
        continue
      continue
    else:
      break
  
  
  print(cnt)

Solution (Python):
S = sorted(input())
T = sorted(input())[::-1]

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

Solution (Python):



S = sorted(input())
T = list(reversed(sorted(input())))

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

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

Solution (Python):

s = input()
t = input()

sd = sorted(s)
td = sorted(t, reverse=True)

if sd < td:
    print('Yes')
else:
    print('No')

Solution (Python):


s = input()
t = input()

sd = sorted(list(str(s)))


td = sorted(list(str(t)), reverse = True)


lis = ["".join(sd), "".join(td)]

c_lis = sorted(lis)

if lis[0] == c_lis[0]:
    if lis[0] == lis[1]:
        print("No")
    else:
        print("Yes")
else:
    print("No")

Solution (Python):
s = input()
t = input()
S = sorted([x for x in s])
T = sorted([x for x in t], reverse = True)
print('Yes' if ''.join(S) < ''.join(T) else 'No')

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

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

s = sorted(s)
t = sorted(t,reverse = True)
ans = "Yes" if s < t else "No"
print(ans)

Solution (Python):
s=sorted([i for i in input()])
t=list(reversed(sorted([i for i in input()])))
flg="same"
for i in range(min(len(s),len(t))):
  if s[i]<t[i]:
    flg="large" 
    break
  elif s[i]>t[i]:
    flg="small"
    break
    
if flg=="same" and len(s)<len(t):
  flg="large"
print("Yes" if flg=="large" else "No")

Solution (Python):
s = list(str(input()))
t = list(str(input()))
alp = 'abcdefghijklmnopqrstuvwxyz'
slst = []
tlst = []

for i in range(len(s)):
    slst.append(alp.find(s[i]))
for i in range(len(t)):
    tlst.append(alp.find(t[i]))

if min(slst)>max(tlst):
    print('No')
elif min(slst)==max(tlst):
    if max(slst)>min(tlst):
        print('No')
    else:
        if len(slst)>=len(tlst):
            print('No')
        else:
            print('Yes')
else:
    print('Yes')

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

s = sorted(s)
t = sorted(t,reverse = True)
ans = "Yes" if s < t else "No"
print(ans)

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

s = "".join(sorted(list(s)))
t = "".join(sorted(list(t),reverse = True))
ans = "Yes" if s < t else "No"
print(ans)

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

ns = sorted(s)
nt = sorted(t, reverse=True)

if ns < nt:
    print('Yes')
else:
    print('No')

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

s.sort()
t.sort(reverse=True)

if s==t:
  print("No")
else:
  u=[s,t]
  u.sort()
  if u[0]==s:
    print("Yes")
  else:
    print("No")

Solution (Python):
from sys import stdin, exit
import itertools


if __name__ == "__main__":
    s = stdin.readline().rstrip()
    t = stdin.readline().rstrip()
    
    s = sorted(s)
    t = sorted(t, reverse=True)
    
    print("Yes" if s < t else "No")

Solution (Python):
x=input()
y=input()
if x==y:
    print('No')
else:
    s=list(x)
    t=list(y)
    s.sort()
    t.sort()
    t.reverse()

    a=''.join(s)
    b=''.join(t)
    l=[[a,1],[b,2]]
    l.sort()
    if l[0][1]<l[1][1]:
        print('Yes')
    else:
        print('No')

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

if ''.join(sorted(s)) < ''.join(sorted(t, reverse=True)):
    print('Yes')
else:
    print('No')

Solution (Python):

s=input()
t=input()
n=min(len(s),len(t))
flag=False
new_s="".join(sorted(s))
new_t="".join(sorted(t)[::-1])
for i in range(n):
    if i==n-1 and new_s[i]==new_t[i] and len(s)<len(t):
        flag=True
    if new_s[i]<new_t[i]:
        flag=True
        break
print("Yes" if flag else "No")

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

s_=sorted(s)
t_=sorted(t, reverse=True)

if s_ < t_:
    print("Yes")
else:
    print("No")

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

ss = sorted(s)
tt = sorted(t)

sss = "".join(ss)

tt.reverse()
ttt = "".join(tt)

if sss < ttt:
  print("Yes")
else:
  print("No")

Solution (Python):
s = sorted(list(input()))
t = sorted(list(input()),reverse = True)
ans = sorted([s,t])
if ans[0] == s and s != t:
    print('Yes')
else:
    print('No')

Solution (Python):
print("Yes" if sorted(input()) < sorted(input())[::-1] else "No")

Solution (Python):
a = input()
b = input()
a = sorted(a)
b = sorted(b, reverse=True)
print('Yes' if a < b else 'No')

Solution (Python):
def main():
    s = list(input())
    t = list(input())
    s.sort()
    t.sort(reverse=True)

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

if __name__ == '__main__':
    main()

Solution (Python):
s=list(input())
s.sort()
t=list(input())
t.sort(reverse=True)
ss="".join(s)
tt="".join(t)
if ss<tt:
  print("Yes")
else:
  print("No")

Solution (Python):




yes = "Yes"
no = "No"


def solver(sstr, tstr):
    result = True
    sfirst_str = ''.join(sorted(list(sstr)))
    tend_str = ''.join(reversed(sorted(list(tstr))))
    if sfirst_str < tend_str:
        result = True
    else:
        result = False
    return result


if __name__ == "__main__":
    s = input()
    t = input()
    if solver(s, t):
        print(yes)
    else:
        print(no)

Solution (Python):
s = input()
t = input()
S = sorted(s)
T = sorted(t, reverse=True)
S_moji = "".join(S)
T_moji = "".join(T)

print("Yes" if S_moji<T_moji else "No")

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

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
s = list(input().rstrip())
t = list(input().rstrip())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    x, y = s[i], t[i]
    if alpha2num(x) < alpha2num(y):
        print("Yes")
        sys.exit()
    elif alpha2num(x) > alpha2num(y):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

s, t = sys.stdin.read().split()

def main():
    return 'Yes' if ''.join(sorted(s)) < ''.join(sorted(t))[::-1] else 'No'

if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):




yes = "Yes"
no = "No"


def solver(wordStrS, wordStrT):
    result = ""
    wordSStr = ''.join(list(sorted(wordStrS)))
    strTSort = ''.join(list(reversed(list(sorted(wordStrT)))))
    if wordSStr < strTSort:
        result = yes
    else:
        result = no
    return result


if __name__ == "__main__":
    result = ''
    s = input()
    t = input()
    result = solver(s, t)
    print(result)

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

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

Solution (Python):
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')

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

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

Solution (Python):
S = list(input())
N = len(S)
T = list(input())
M = len(T)
S.sort()
T.sort(reverse = True)
mmm = min(N, M)

for i in range(mmm):
    if S[i] > T[i]:
        print("No")
        exit()
    elif S[i] < T[i]:
        print("Yes")
        exit()
    else:
        continue

if N < M:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):



S = list(input())
T = list(input())
S = sorted(S)
T = sorted(T,reverse = True)

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

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


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

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


ss=list(s)
tt=list(t)
ss.sort()
tt.sort(reverse=True)

s,t=map(''.join,[ss,tt])

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

Solution (Python):
import math

s, t = [input() for i in range(2)]

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

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

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

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

Solution (Python):
s = [i for i in input()]
t = [i for i in input()]
s.sort()
t.sort(reverse=True)
if "".join(s) < "".join(t):
    print("Yes")
else:
    print("No")

Solution (Python):


s = input()
t = input()

s = "".join(list(sorted(s)))
t = "".join(list(sorted(t, reverse=True)))
ans = "Yes" if s < t else "No"
print(ans)

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

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

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

sd = sorted(s)
td = sorted(t, reverse=True)

if sd < td:
  print('Yes')
else:
  print('No')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

s = input()
t = input()

if s < t:
	print("Yes")
	sys.exit()
tmp = sorted(s)[0]
for x in t:
	if x > tmp:
		print("Yes")
		break
else:
	print("No")

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

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

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

Solution (Python):
s=[i for i in input()]
t=[j for j in input()]
s.sort()
t.sort()
flag=0
count=0

if len(s)<len(t):
  for i in range(len(s)):
    if s[i]==t[i]:
      count+=1
  else:
    if count==len(s):
      flag=1

t.sort(reverse=True)

if s[0]<t[0]:
    flag=1

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)
if "".join(s) < "".join(t):
    print("Yes")
else:
    print("No")