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):
s = input()
t = input()

s = "".join(sorted(s))
t = "".join(sorted(t)[::-1])

print( "Yes" if s<t else "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()

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

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

Solution (Python):
import sys

input = sys.stdin.readline
s = list(input().strip())
t = list(input().strip())
if sorted(s) < sorted(t, reverse=True):
    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):
s = list(input().rstrip())
t = list(input().rstrip())

alphabet = ["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)):
    s[i] = alphabet.index(s[i])
for i in range(len(t)):
    t[i] = alphabet.index(t[i])
s.sort()
t.sort()
t.reverse()
flg = "Yes"
check = 0
for j in range(min(len(s),len(t))):
    if t[j] > s[j]:
        check = 1
        break
    elif t[j] < s[j]:
        flg = "No"
        check = 1
        break
if check == 0:
    if len(s) >= len(t):
        flg = "No"
print(flg)

Solution (Python):
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)
s="".join(s)
t="".join(t)
if 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):
s = sorted(list(input()))
t = sorted(list(input()),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):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
print('Yes' if s < t 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 = list(str(input()))
t = list(str(input()))

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

print("Yes" if ''.join(asc_s) < ''.join(desc_t) else "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 = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
def answer(s: str, t: str) -> str:
    return 'Yes' if sorted(s) < sorted(t, reverse=True) else 'No'

def main():
    s = input()
    t = input()
    print(answer(s,t))

if __name__ == '__main__':
    main()

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

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

sa = ''.join(ss)
ta = ''.join(tt)

if sa < ta:
  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(reverse=True)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

if 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):
s = list(input())
t = list(input())

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

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

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

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

s1 = ''.join(s)
t1 = ''.join(t)

if 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):
s = str(input())
t = str(input())

num2alpha = lambda c: chr(c+96)

alpha2num = lambda c: ord(c) - ord('a') + 1


S = [0] * 26
T = [0] * 26
for i in range(len(s)):
  S[alpha2num(s[i]) - 1] += 1
for i in range(len(t)):
  T[alpha2num(t[i]) - 1] += 1

  
ss = 0
while S[ss] == 0:
  ss += 1
tt = 25
while T[tt] == 0:
  tt -= 1
  
if tt < ss:
  print("No")
elif tt > ss:
  print("Yes")
else:
  if (T[tt] == sum(T)) and (S[ss] == sum(S)):
    if sum(T) > sum(S):
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Solution (Python):
s = input()
t = input()
sd = sorted(s)
td = reversed(sorted(t))
sd = "".join(sd)
td = "".join(td)
if sd < td:
    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)

ans_ = [S,T]
ans_.sort()

ans='Yes'
if ans_[0] == T:
    ans='No'
    
print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**6)

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

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

s = "".join(s)
t = "".join(t)

ans = sorted([s, t])


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

Solution (Python):

import sys
sys.setrecursionlimit(10**6)

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

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

s = "".join(s)
t = "".join(t)

ans = sorted([s, t])


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

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

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

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


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

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

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

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

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

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

Solution (Python):
S=sorted(input())
T=sorted(input())
for i in range(min(len(S),len(T))):
  if S[i] < T[-1*(i+1)]:
    print("Yes")
    break
  elif S[i] == T[-1*(i+1)]:
    if i+1 == min(len(S),len(T)) and len(S) < len(T):
      print("Yes")
      break
    
  else:
    print("No")
    break
else:
  print("No")

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

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

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

Solution (Python):
from collections import defaultdict

s = input()
t = input()

AL = "abcdefghijklmnopqrstuvwxyz"
S = defaultdict(int)
T = defaultdict(int)

for al in s:
  S[al] += 1

for al in t:
  T[al] += 1

ans_s = ""
for al in AL:
  ans_s += al*S[al]

ans_t = ""
for al in reversed(list(AL)):
  ans_t += al*T[al]

if ans_s < ans_t:
  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 = input()
t = input()
 
sp = sorted(s)
tp = sorted(t, reverse=True)

print('Yes' if sp < tp else 'No')

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

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

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

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

Solution (Python):
s = sorted(list(input()))
t = reversed(sorted(list(input())))
if ",".join(s) < ",".join(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):
s,t=[input() for i in range(2)]
print('Yes' if sorted(s)<sorted(t,reverse=True) else 'No')

Solution (Python):

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

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

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

s.sort(reverse=False)
t.sort(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 = list(input())
T = list(input())

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

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

if t > s:
    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 = input()
    t = input()
    s_list = []
    t_list = []
    for i in range(len(s)):
        s_list.append(s[i])
    for i in range(len(t)):
        t_list.append(t[i])
    s_list.sort()
    t_list.sort(reverse = True)
    
    
        
    s_l = len(s_list)
    t_l = len(t_list)
    if s_l >= t_l:
        ans = 'No'
    else:
        ans = 'Yes'

    for i in range(min(s_l,t_l)):
        if s_list[i] == t_list[i]:
            continue
        elif s_list[i] > t_list[i]:
            return ('No')
        else:
            return('Yes')

    return ans

print(main())

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

l="abcdefghijklmnopqrstuvwxyz"

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

if l.index(str[0])>l.index(ss[0]):
  ans="Yes"
elif len(t)>len(s) and ss in st:
  ans="Yes"
else:
  ans="No"
  
print(ans)

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)

INF = 10**18
import bisect
import statistics
mod = 10**9+7


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)

if S >= T:
    print("No")
else:
    print("Yes")

Solution (Python):
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)
for i in range(min(len(s),len(t))):
    if ord(s[i])<ord(t[i]):
        print("Yes")
        exit()
    elif ord(s[i])>ord(t[i]):
        print("No")
        exit()
if len(s)>=len(t):
    print("No")
else:
    print("Yes")

Solution (Python):
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  S=input()
  T=input()
  if S==T:
    print("No")
    return
  if S in T:
    print("Yes")
    return
  s=list(S)
  t=list(T)
  
  s.sort()
  t.sort(reverse=True)
  if s==t:
    print("No")
    return
  



  for i in range(min(len(s),len(t))):
    if ord(s[i])>ord(t[i]):
      print("No")
      return
    elif ord(s[i])<ord(t[i]):
      print("Yes")
      return
  print("No")
  return
main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

lens = len(s)
lent = len(t)
for i in range(lens):
    if i==lent:
        print('No')
        exit()
    if s[i]<t[i]:
        print('Yes')
        exit()
    elif s[i]>t[i]:
        print('No')
        exit()
else:
    if len(t)==len(s):
        print('No')
    else:
        print('Yes')

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

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

arr = [t_d,s_d]
arr=sorted(arr)

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

if arr[0]==s_d:
    print('Yes')
else:
    print('No')

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

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

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

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

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

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

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

s = "".join(s)
t = "".join(t)

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

Solution (Python):
s = sorted(list(input().strip()))
t = sorted(list(input().strip()),reverse=True)
if s<t:
    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()
t = input()
import sys
if s==t:
    print("No")
    sys.exit()
ss = sorted(list(s))
tt = sorted(list(t))[::-1]
if sorted([ss,tt])[0] == ss:
    print("Yes")
else:
    print("No")

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

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

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


flag = [0,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
        elif i == len(s)-1:
            print('Yes')
elif len(s) > len(t):
    for i in range(len(t)):
        if s[i]<t[i]:
            print('Yes')
            break
        elif s[i] > t[i]:
            print('No')
            break
        elif i == len(t)-1:
            print('No')
elif 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
        elif i == len(s)-1:
            print('No')

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

s,t = input(),input()

def str_to_list(x):
    l = []
    for i in range(len(x)):
        l.append(ord(x[i]))
    return l

def list_to_str(l):
    l = list(map(chr,l))
    return ''.join(l)

s = str_to_list(s)
s.sort()
s = list_to_str(s)
t = str_to_list(t)
t.sort(reverse=True)
t = list_to_str(t)
judge(s<t)

Solution (Python):
s, t = sorted(input()), sorted(input())[::-1]

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

Solution (Python):
s=input()
t=input()
data=['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=[0]*len(s)
T=[0]*len(t)
for i in range(len(s)):
  S[i]=data.index(s[i])
for i in range(len(t)):
  T[i]=data.index(t[i])
S.sort()
T.sort(reverse=True)
if S<T:
  print('Yes')
else:
  print('No')

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

if anas < at:
    print('Yes')
else:
    print('No')

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

miji = min(len(s),len(t))
for i in range(miji):
    if ord(anas[i]) < ord(at[i]):
        print('Yes')
        exit()
    elif ord(anas[i]) > ord(at[i]):
        print('No')
        exit()

if len(s) < len(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('No' , flush=True)
else:
    print('Yes' , flush=True)

Solution (Python):
s = input()
t = input()
s = sorted(s)
t = sorted(t, reverse=True)
s_t = [s, t]
s_t.sort()
if s_t[0] == s and s_t[1] != s:
    print("Yes")
else:
    print("No")

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

Solution (Python):

import sys
def input():
    return sys.stdin.readline()[:-1]

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

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

    listT = []
    for i in range(len(t)):
        listT.append(t[i])

    listS = sorted(listS)
    listT = sorted(listT, reverse=True)

    sortedS = ''
    for i in range(len(listS)):
        sortedS += listS[i]
    sortedT = ''
    for i in range(len(listT)):
        sortedT += listT[i]

    if sortedS < sortedT:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

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





if __name__=="__main__":
    main()

Solution (Python):
s = "".join(sorted(str(input())))
t = "".join(sorted(str(input()), reverse=True))
if 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)

s = "".join(s)
t = "".join(t)

print("Yes") if s < t 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()

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

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

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

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

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


def checker(s, t):
    for sz in ss:
        for tz in tt:
            if sz > tz:
                return 'No'
            elif sz == tz:
                continue
            else:
                return 'Yes'
    if len(ss) < len(tt):
        return 'Yes'
    return 'No'


print(checker(ss, tt))

Solution (Python):

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

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

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

Solution (Python):

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

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

result = 'No'
rang = min(len(s),len(t))
for i in range(rang):
    if ord(s[i]) < ord(t[i]):
        result = 'Yes'
        break
else:
    
    if (s[:rang] == t[:rang]) and len(s) < len(t):
        result = 'Yes'
print(result)

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

Solution (Python):
a, b = [sorted(input()) for i in range(2)]
print("Yes" if a < b[::-1] else "No")

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

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

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

alpha = list('abcdefghijklmnopqrstuvwxyz')

check = False
cnt = 0
for s, t in zip(S,T):
  res = alpha.index(s) - alpha.index(t)
  if res < 0:
    check = True
    break
  elif res == 0:
    cnt += 1

if cnt == len(S):
  if len(S) < len(T):
    check = True

print("Yes" if check else "No")

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

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

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




if sorted_s < sorted_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()
S = sorted(s)
T = sorted(t,reverse=True)

ans = "W"
for i in range(min(len(s),len(t))):
    if S[i] > T[i]:
        ans = "No"
        break
    elif ans == "W" and S[i] == T[i]:
        ans = "W"
    elif ans == "W" and S[i] < T[i]:
        ans = "Yes"
        break
if ans == "W":
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"
print(ans)

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

Solution (Python):
s = sorted(input())
t = sorted(input(),reverse = True)
flag1 = True
flag2 = False
if len(s) < len(t):
    for i in range(len(s)):
        if s[i] != t[i]:
            flag1 = False
            break
else:
    flag1 = False
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        flag2 = True
        break
    elif s[i] > t[i]:
        break
if flag1 or flag2:
    print('Yes')
else:
    print('No')

Solution (Python):



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


main()

Solution (Python):
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial

from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]







s = S()
t = S()

s = list(s)
s.sort()
t = list(t)
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 = str(input())
t = str(input())


sort_s_list = sorted(s)
sort_s = "".join(sort_s_list)


t_list = list(t)
t_list.sort(reverse = True)
reverse_sort_t = "".join(t_list)

if sort_s < reverse_sort_t:
    print("Yes")
else:
    print("No")

Solution (Python):



def main():
    s = list(input())
    t = list(input())
    s.sort()
    t.sort(reverse=True)
    l = len(s)
    tl = len(t)
    if l > tl:
        l = tl
    for i in range(l):
        if s[i] == t[i]:
            continue
        if t[i] > s[i]:
            print("Yes")
            return
        print("No")
        return
    if l == tl:
        print("No")
        return
    print("Yes")


if __name__ == "__main__":
    main()

Solution (Python):


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

N = len(s)
M = len(t)

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

ans ='No'
if N < M:
    new_t = "".join(t_d[:N])
    new_s = "".join(s_d)
    if new_t == new_s:
        ans ='Yes'

if ans == 'No':
    pos = 0
    for i in range(min(N, M)):
        if s_d[i]!=t_d[i]:
            pos = i
            break
    if s_d[pos] < t_d[pos]:
        ans ='Yes'

print(ans)

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

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

answer = "Yes"
for i in range(len(s)):
  if i == len(t):
    answer = "No"
    break
  s_c = s[i]
  t_c = t[i]
  if s_c < t_c:
    break
  elif s_c == t_c:
    continue
  else:
    answer = "No"
    break

if s == t:
  answer = "No"

print(answer)

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

l = [''.join(s),''.join(t)]

if l == sorted(l) and l[0]!=l[1]:
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()
T = input()
S_len = len(S)
T_len = len(T)
S_sorted = sorted(S)
T_sorted = sorted(T, reverse=True)
ans = True
for i in range(min(S_len, T_len)):
    s = ord(S_sorted[i])
    t = ord(T_sorted[i])
    if s < t:
        print('Yes')
        exit(0)
    if s == t:
        continue
    else:
        print('No')
        exit(0)
if S_len >= T_len:
    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):
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 = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

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

Solution (Python):
s, t = [input() for i in range(2)]
ns = ''.join(sorted(s))
nt = ''.join(sorted(t, reverse=True))
print('Yes') if ns < nt else print('No')

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

if sorted(S) < sorted(T,reverse=True) :
  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):
s = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()))[::-1])
print('Yes' if s < t else 'No')

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

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

if s_2 < t_2:
    print("Yes")
else:
    print("No")

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
enu = enumerate
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = list(input())
T = list(input())

S.sort()
T.sort(reverse=True)
for s, t in zip(S, T):
    if ord(s) < ord(t):
        
        print("Yes")
        exit()
    elif ord(s) > ord(t):
        
        print("No")
        exit()
else:
    if len(S) < len(T):
        print("Yes")
    else:
        print("No")

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

s_list = list(s)
t_list = list(t)

s_sorted = sorted(s_list)
t_sorted = sorted(t_list, reverse=True)

s_joined = ''.join(s_sorted) 
t_joined = ''.join(t_sorted) 

if s_joined < t_joined:
    print("Yes")
else:
    print("No")

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    s = S()
    t = S()
    sl = list(s)
    tl = list(t)
    sl.sort()
    tl.sort(reverse=True)
    s = "".join(sl)
    t = "".join(tl)
    print("Yes" if s < t else "No")
main()

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

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