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):
import sys

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

for c_s, c_t in zip(s, t):
    if c_s < c_t:
        print('Yes')
        sys.exit()
    elif c_s > c_t:
        print('No')
        sys.exit()

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

Solution (Python):
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque








def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_I(): return map(int, stdin)
def ALL_IL(): return LM(int,stdin)


def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))





def main():
	s = sorted(input())
	t = sorted(input(),reverse=True)

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


if __name__ == '__main__':
	main()

Solution (Python):
s = input()
s_sort = ''.join(sorted(s))

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

if s_sort < t_sort:
    print('Yes')
else:
    print('No')

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




a = "".join( sorted(a) )
b = "".join( sorted(b, reverse=True) )




ans="Yes"
if a >= b: ans="No"

print(ans)

Solution (Python):


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

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

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

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

ss,tt = sorted(s),sorted(t,reverse=True)
for i in range(min(len(ss),len(tt))):
    if ss[i] < tt[i]:
        print("Yes")
        break
    elif ss[i] > tt[i]:
        print("No")
        break
else:
    if len(tt) <= len(ss):
        print("No")
    else:
        print("Yes")

Solution (Python):
print 'Yes' if sorted(raw_input()) < sorted(raw_input())[::-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):
def solv():
    s = sorted(input())
    t = sorted(input(),reverse=True)

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

if __name__ == '__main__':
    solv()

Solution (Python):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
new_s = ''.join(s)
new_t = ''.join(t)
lis = [new_s, new_t]
lis.sort()
if lis[0] == new_s and lis[1] != new_s:
    print("Yes")
else:
    print("No")

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

Solution (Python):

s = input()

s_asc = sorted(s)
t = input()

t_desc = sorted(t, reverse = True)

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

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

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

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

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		exit(0)

	elif ord(T) < ord(S):
		print("No") 
		exit(0)

if len(s) < len(t):
	print("Yes")

else:
	print("No")

Solution (Python):

import sys

A = list(input())
B = list(input())
A.sort()
B.sort(reverse=True)

if A < B:
    print('Yes')
else:
    print('No')

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

    t.reverse()

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

solve()

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

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

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

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

slist = []
tlist = []

for i in s:
    slist.append(i)
for i in t:
    tlist.append(i)
    
sortedslist = sorted(slist)
sortedtlist = sorted(tlist)



sample ='abcdefghijklmnopqrstuvwxyz'

def checktoend(sa, ta):
    n = min(len(sa), len(ta))
    end = 0
    for i in range(n):
        for x in sample:
            if sa[i]==x and ta[-(i+1)]==x:
                break
            elif sa[i]==x and ta[-(i+1)]!=x:
                print('Yes')
                end = 1
                break
            elif sa[i]!=x and ta[-(i+1)]==x:
                print('No')
                end = 1
                break
        if end == 1:
            break
    else:
        if len(sa)<len(ta):
            print('Yes')
        else:
            print('No')

checktoend(sortedslist, sortedtlist)

Solution (Python):
a=raw_input()
b=raw_input()
a=list(a)
a.sort()
b=list(b)
b.sort()
b.reverse()

ch=0
for i in range(len(b)):
    if len(a)-1>=i:

        if a[i]<b[i]:
            ch=1
            break
    else:

        if a[:i]==b[:i]:
            ch=1

if ch==1:
    print "Yes"
else:
    print "No"

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

Solution (Python):
s = list(input())
t = list(input())
 
def f(s, t):
  s.sort()
  t.sort(reverse=True)
  s_sum = 0
  t_sum = 0
  for i in range(len(s)):
    s[i] = ord(s[i])
  
  for i in range(len(t)):
    t[i] = ord(t[i])
  
  for i in range(len(s)):
    if not i + 1 >= len(t):
      s_sum += s[i]
      t_sum += t[i]

      if s_sum < t_sum:
        return 'Yes'
      elif s_sum > t_sum:
        return 'No'
    else:
      break

  if len(s) < len(t):
    return 'Yes'
  else:
    return 'No'

print(f(s, t))

Solution (Python):
a = list(raw_input())
b = list(raw_input())

a = sorted(a)
b = sorted(b)
new_a = []
new_b = []
for x in a:
  if ord(x) >= ord('a') and ord(x) <= ord('z'):
     new_a.append(x)
      
for x in b:
  if ord(x) >= ord('a') and ord(x) <= ord('z'):
     new_b.append(x)

new_a = new_a
new_b = new_b[::-1]
la = len(new_a)
lb = len(new_b)

for x in range(101):
  if x >= lb:
    print "No"
    exit(0)
  if x >= la:
    print "Yes"
    exit(0)
  if ord( new_a[x] ) > ord( new_b[x] ):
    print "No"
    exit(0)
  if ord( new_a[x] ) < ord( new_b[x] ):
    print "Yes"
    exit(0)

Solution (Python):
import string
if __name__=="__main__":
    s = list(input())
    t = list(input())
    min_s = 27
    max_t = 0
    dic = list(string.ascii_lowercase)
    c = 0
    for j in range(len(s)):
        if s[j] in t:
            c+=1
    if c==len(s) and c<len(t):
        print("Yes")
        exit()
    for i in string.ascii_lowercase:
        if s.__contains__(i):
            min_s = min(min_s,dic.index(i)+1)
        if t.__contains__(i):
            max_t = max(max_t,dic.index(i)+1)
    if max_t<=min_s:
        print("No")
    else:
        print("Yes")

Solution (Python):
import string
lisL = list(string.ascii_lowercase)
dic = dict(zip(lisL,list(range(26))))
s = input()
t = input()
lisT = list(reversed(sorted(t)))
lisS = list(sorted(s))
for sitem,titem in zip(lisS[0:min( len(lisT),len(lisS) )],lisT[0:min( len(lisT),len(lisS) )]):
  if dic[sitem] < dic[titem]:
    print ("Yes")
    break
  elif dic[sitem] > dic[titem]:
    print ("No")
    break
else:
  if len(lisT) > len(lisS):
    print ("Yes")
  else:
    print ("No")

Solution (Python):
import sys
s_ls = sys.stdin.read().split("\n")
s = "".join(sorted(s_ls[0]))
t = "".join(sorted(s_ls[1]))[::-1]
if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input().strip()
t=input().strip()
s=sorted(s,key=lambda x:ord(x))
t=sorted(t,key=lambda x:-ord(x))
if s<t: print("Yes")
else:print("No")

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()
p = []
q = []
m = len(s)
n = len(t)
if m >= n:
    ans = "No"
else:
    ans = "Yes"
for i in range(m):
    p.append(s[i])
p.sort()
for j in range(n):
    q.append(t[j])
q.sort(reverse=True)
for k in range(min(m,n)):
    if ord(p[k]) < ord(q[k]):
        ans = "Yes"
        break
    elif ord(p[k]) > ord(q[k]):
        ans = "No"
        break
print(ans)

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

count = 0
for i in range(min(len(t),len(s))):
    if t[i] == s[i]:
        count += 1
if count == min(len(t),len(s)):
    if len(s)<len(t):
        print("Yes")
    else:
        print("No")
        

elif s[0]<t[len(t)-1]:

    print("Yes")


else:
    print("No")

Solution (Python):
debug = False
if debug:
    s = "zzz"
    t = "zzz"
else:
    s = input()
    t = input()

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

Solution (Python):
import sys

line1 = sys.stdin.readline()
line2 = sys.stdin.readline()

line1 = line1.replace('\n', '')
line2 = line2.replace('\n', '')

line1 = sorted(line1)
line2 = sorted(line2, reverse=True)




flag = 0
if len(line1) < len(line2):
    flag = 1

if flag == 1:
    for x, y in zip(line1, line2):
        if x > y:
            flag = 0
            break
        elif x < y:
            flag = 1
            break

else:
    for x, y in zip(line1, line2):
        if x < y:
            print("Yes")
            flag = -1
            break

if flag == 1:
    print("Yes")
elif flag != -1:
    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()

s1 = sorted(s)
s2 = "".join(s1)
t1 = sorted(t, reverse=True)
t2 = "".join(t1)

l = [s2, t2]
l.sort()

if s == t:
  print("No")
elif l[0] == s2:
  print("Yes")
else:
  print("No")

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

s.sort()
t.sort()
t = t[::-1]

import sys

for i, j in zip(s, t):
    if j > i:
        print('Yes')
        sys.exit(0)

if len(s) < len(t):
    for i in s:
        if i not in t:
            print('No')
            sys.exit(0)

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

Solution (Python):
s = input()
t = input()
S = []
T = []
Ans = []
for i in range(len(s)):
	S.append(s[i])
S.sort()
moziretu1 = "".join(S)

for i in range(len(t)):
	T.append(t[i])
T.sort(reverse=True)
moziretu2 = "".join(T)

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()
t.reverse()

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

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

smax = max(s)
tmax = max(t)
smin = min(s)
tmin = min(t)

ans = False

if tmax > smin:
    ans = True
elif tmax < smax:
    ans = False
else:
    if len(t) > len(s):
        ans = True

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

Solution (Python):
S = raw_input()
T = raw_input()

s_array = list(S)
t_array = list(T)



s_array.sort()
t_array.sort()
t_array.reverse()



result = 'both'

while len(s_array) > 0:
    item_s = s_array.pop(0)
    tmp_array = t_array[:]
    while len(tmp_array) > 0:
        item_t = tmp_array.pop(0)

        if item_s < item_t:
            result = 'Yes'
            break
        elif item_s > item_t:
            result = 'No'
            break
        else:
            pass
    
    if result == 'Yes' or result == 'No':
        break

if result == 'Yes' or result == 'No':
    print result
else:

    if len(S) < len(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):

import math

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

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

Solution (Python):


s = input()
t = input()

def bSort(a):
    for i in range(len(a)):
        for j in range(len(a)-1, i, -1):
            if a[j] < a[j-1]:
                a[j], a[j-1] = a[j-1], a[j]

    return a

def bSort2(a):
    for i in range(len(a)):
        for j in range(len(a)-1, i, -1):
            if a[j] > a[j-1]:
                a[j], a[j-1] = a[j-1], a[j]
    return a


def add_list(a):
    sumed = ""
    for i in a:
        sumed += i
    return sumed

s_list = list(s)
s_ = add_list(bSort(s_list))

t_list = list(t)
t_ = add_list(bSort2(t_list))

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

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

s_ = "".join(sorted(s))
t_ = "".join(reversed(sorted(t)))

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

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

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

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

res = 'No'
for i in range(len(tp)):
  if i > len(sp) - 1:
    res = 'Yes'
    break
  if tp[i] > sp[i]:
    res = 'Yes'
    break
  elif tp[i] < sp[i]:
    break

print(res)

Solution (Python):


s=input()
t=input()

if(len(s)>len(t)):
    min_len=len(t)
else:
    min_len=len(s)

ss=[]
for num in range(0, len(s)):
    ss.append(s[num])

tt=[]
for num in range(0, len(t)):
    tt.append(t[num])

ss.sort()
tt.sort()
tt.reverse()

if(ss>=tt):
    print("No")
else:
    print("Yes")

Solution (Python):




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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
s=list(raw_input())
t=list(raw_input())
s.sort()
t.sort()
t.reverse()
N=len(s)
M=len(t)


for i in s:
	for j in t:
		if j==i:
			pass
		elif j>i:
			print "Yes"
			sys.exit()
		else:
			print "No"
			sys.exit()
else:
	if M>N:
		print "Yes"
	else:
		print "No"

Solution (Python):


s = input()
t = input()

x = len(s)
y = len(t)

p = []
q = []

for i in range(x):
    p.append(ord(s[i]))

for j in range(y):
    q.append(ord(t[j]))

p.sort()
q.sort(reverse=True)

if p < q:
    print("Yes")
else:
    print("No")

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

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

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):
a=input().strip()
b=input().strip()
aa=[]
for i in a:
  aa.append(i)
aa.sort()
aaa="".join(aa)

bb=[]
for i in b:
  bb.append(i)
bb.sort(reverse=True)
bbb="".join(bb)
ccc=[aaa,bbb]
ccc.sort()

if bbb==ccc[0]:
  print('No')
else:
  print('Yes')

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

x = ''.join(sorted(s))
y = ''.join(sorted(t))
if x[0] < y[-1]:
    print ('Yes')
elif (x in y) and x != y:
    print ('Yes')
else:
    print ('No')

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


sS = "".join(sorted(S))
sT = "".join(sorted(T, reverse = True))
if (sS < sT):
	print("Yes")
else:
	print("No")

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

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

for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
        print("Yes")
        break
    elif s[i] == t[i]:
        if i == min(len(s),len(t))-1:
            if len(s) >= len(t):
                print("No")
            else:
                print("Yes")
    else:
        print("No")
        break

Solution (Python):
s=input()
t=input()
count=0
list01 = list(s)
list02 = list(t)
list01.sort()
list02 = list(t)
list02.sort()

if len(s)<len(t):
    for i in range(len(s)):
        if list01[i]>list02[len(t)-1-i]:
            print("No")
            break
        elif list01[i]<list02[len(t)-1-i]:
            print("Yes")
            break
    else:
            print("Yes")            

else:
    for i in range(len(t)):
        if list01[i]>list02[len(t)-1-i]:
            print("No")
            break

        elif list01[i]<list02[len(t)-1-i]:
            print("Yes")
            break
    else:
            print("No")

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

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

s = list(s)
s.sort()

t = list(t)
t.sort()
t.reverse()

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

Solution (Python):



s = input()
t = input()


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


if s == t:
    print("No")
elif st_list == sorted(st_list):
    print("Yes")
else:
    print("No")

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

S = sorted(list(s))
T = reversed(sorted(list(t)))
s = "".join(S)
t = "".join(T)
L = [s, t]
L2 = sorted(L)
if s == t:
    print("No")
else:
    if L == L2:
        print("Yes")
    else:
        print("No")

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

s_list=[]
for i in range(len(s)):
    s_list.append(s[i])

t_list=[]
for i in range(len(t)):
    t_list.append(t[i])
s_list=sorted(s_list)
t_list=sorted(t_list,reverse=True)


ans=False
comp_max_index=min(len(s_list),len(t_list))
for i in range(min(len(s_list),len(t_list))):
    if s_list[i]<t_list[i]:
        ans=True
        break
if ans==True:
    print('Yes')
else:
    if s_list[comp_max_index-1]==t_list[comp_max_index-1] and len(s_list)<len(t_list) :
        print('Yes')
    else:
        print('No')

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

ss = s[::-1]
tt = t[::-1]
ss.sort()
tt.sort()

if(min(s) < max(t) or (len(s) < len(t) and ss == tt[:len(s)])):
    print("Yes")
else:
    print("No")

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

is_short = len(s) < len(t)

sd = sorted(s)
td = sorted(t)

for v in td:
    if ord(sd[0]) < ord(v):
        print('Yes')
        sys.exit()

if len(set(sd)) == 1 and len(set(td)) == 1 and is_short:
    print('Yes')
    sys.exit()

print('No')

Solution (Python):
ss=input()
tt=input()
s=[]
t=[]
for i in ss:
    s.append(i)
for i in tt:
    t.append(i)
sss=sorted(s)
ttt=sorted(t)
ssss=""
tttt=""
for i in sss:
    ssss+=i
for i in range(len(ttt)):
    tttt+=ttt[len(ttt)-i-1]
if ssss<tttt:
    print("Yes")
else:
    print("No")

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

tt = sorted(t,reverse=True)

if tt>ss:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
t = input()
sli = list(s)
tli = list(t)
sli.sort()
tli.sort()
tli.reverse()
def tostr(lis):
    hoge = ""
    for i in lis:
        hoge += i
    return hoge
tstr = tostr(tli)
sstr = tostr(sli)
if tstr > sstr:
    print("Yes")
else:
    print("No")

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

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

if __name__ == '__main__':
    main()

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

slist = [ord(i) for i in s]
tlist = [ord(i) for i in t]
slist.sort()
tlist.sort()
tlist.reverse()

if slist < tlist:
    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 = input().strip()
t = input().strip()
ls = list(s)
lt = list(t)
ls.sort()
lt.sort()
lt.reverse()
s1 = ''.join(ls)
t1 = ''.join(lt)
if s1 < t1:
   print('Yes')
else:
   print('No')

Solution (Python):
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
s1, t1 = "", ""
for i in range(len(s)):
    s1 += s[i]
for i in range(len(t)):
    t1 += t[i]

if s1 < t1:
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())
ans = "Yes"
s.sort()
t.sort(reverse=True)
for i in range(len(s)):
    try:
        if t[i] > s[i]:
            break
        elif t[i] == s[i]:
            pass
        else:
            ans = "No"
    except:
        if len(t) < len(s):
            ans = "No"
if s == t:
    ans = "No"
print(ans)

Solution (Python):



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

Solution (Python):
s, t = ''.join(sorted(input())), ''.join(sorted(input(), 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):
def main():
    S, T = (input() for _ in [0] * 2)

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

main()

Solution (Python):

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

Solution (Python):
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

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

r = s < t

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

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

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

flag = False
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        flag = True
        break
    elif s[i] > t[i]:
        flag = False
        break
    else:
        if i == min(len(s), len(t)) - 1:
            if len(s) < len(t):
                flag = True
            else:
                flag = False

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

Solution (Python):
s = list(input())
t = list(input())
s = sorted(s)
t = 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(list(input()))
t = sorted(list(input()), reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

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

Solution (Python):
val = sorted(input())
val2 = sorted(input(),reverse=True)
print("Yes" if val2 > val else "No")

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

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

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

Solution (Python):

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

Solution (Python):


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

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

if st < tt:
    print('Yes')
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')