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: Accepted

Solution code:
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: Accepted

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 文字列の入力
# 昇順ソート
s = "".join(sorted(list(input())))
# 降順ソート
t = "".join(sorted(list(input()), reverse=True))
# 比較
ans = "Yes" if s < t else "No"
# 表示
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

t = t[::-1]

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


import numpy as np

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

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

Submission status: Accepted

Solution code:


import numpy as np

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

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
s=input()

t=input()

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

Submission status: Accepted

Solution code:
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
#     # M の方が小さくて途中まで同じだったら最終的にFalse
#     return False

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

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

Submission status: Accepted

Solution code:
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
    # M の方が小さくて途中まで同じだったら最終的にFalse
    return False


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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

	


#ratcode altas >> yes

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

## 辞書順の判定
# 文字列を任意に並び変える：
# s: abc順, t: cba順
s_dash = ''.join(sorted(s))
t_dash = ''.join(sorted(t, reverse=True))

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# Problem https://atcoder.jp/contests/abc082/tasks/abc082_b
# Python 3rd Try

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)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
#coding:utf-8
S = str(input())
T = str(input())
S = "".join(sorted(S))
T = "".join(sorted(T))
T = T[::-1]
ST = sorted([S,T])
#print (ST)
if (ST[0]==S and S!=T):
    print ("Yes")
else:
    print ("No")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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')

Submission status: Accepted

Solution code:

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")

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if(s == t):
  print("No")
  
else:
  cnt = "No"
  #まずsを辞書順で一番小さくなるよう並べ替える
  #(単純ソート)
  s_sort = sorted(s)
  
  #tは辞書順で一番大きくなるように並べ替え
  #(逆ソート)
  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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

s = input()
t = input()

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

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

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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
from sys import stdin, exit
import itertools
#stdin = open("input.txt")

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")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#abc082 b-two anagrams
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")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
# Proglem https://atcoder.jp/contests/abc082/tasks/abc082_b
# Python 2nd Try


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)

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# Problem https://atcoder.jp/contests/abc082/tasks/abc082_b
# Python 1st Try


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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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: Accepted

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !

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

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

Submission status: Accepted

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


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

Submission status: Accepted

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

#sを一番若く､tを一番老いさせたい listにしてソート？
ss=list(s)
tt=list(t)
ss.sort()
tt.sort(reverse=True)
#print(ss,tt)
s,t=map(''.join,[ss,tt])
#print(s,t)
if s<t:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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")
# print("".join(s) < "".join(t))
# print(str("".join(s)) < str("".join(t)))

Submission status: Accepted

Solution code:
s = sorted(input())
t = sorted(input(),reverse=True)
ans = ""
def check_dict():
  for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
      ans = "Yes"
      return ans
    elif s[i] > t[i]:
      ans = "No"
      return ans
  return ""
if len(s) < len(t):
  ans = check_dict()
  if ans == "":
    ans = "Yes"
  print(ans)
else:
  ans = check_dict()
  if ans == "":
    ans = "No"
  print(ans)

Submission status: Accepted

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

s = sorted(s)
t = sorted(t)

# print(s,t)
if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(set(s)) ==1 and len(set(t)) ==1 and len(s) < len(t):
    print('Yes')
    exit()
else:
    print('No')

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
S = []
T = []

for i in s:
    S.append(i)
for j in t:
    T.append(j)

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

S = ''.join(S)
T = ''.join(T)

if S < T:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Submission status: Accepted

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

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

st = [ss,tt]
sst = [ss, tt]
sst.sort()

if ss == tt:
    print("No")
elif st == sst:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

ls_org = ["".join(ls_s_1st), "".join(ls_t_last)]

ls_sort = sorted(ls_org)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,t = open(0).read().split()
s = "".join(sorted(s))
t = "".join(sorted(t,reverse=True))
print("Yes" if s<t else "No")

Submission status: Accepted

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

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

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


for i in range(min(len(s), len(t))):
    if ord(s[i]) < ord(t[i]):
        ans = 'Yes'
        break

    elif ord(s[i]) > ord(t[i]):
        ans = 'No'
        break

    else:
        if i == min(len(s), len(t))-1:
            ans = f1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s＿asc = "".join(sorted(s))

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

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