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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(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 = list(input())
t = list(input())
l = sorted(s)
m = sorted(t,reverse = True)
s = ''.join(l)
t = ''.join(m)
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() # ソートした文字列を逆順に並び替え
s=''.join(s)
t=''.join(t)
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

s.sort()
t.sort()

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

Submission status: Accepted

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

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

if ''.join(s) < ''.join(t):
    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('No')
    exit()


if min(s,t) == s:
    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 "".join(s)<"".join(t) else print("No")

Submission status: Accepted

Solution code:
def bb082():
    import sys
    s = list(input())
    t = list(input())

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

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

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

bb082()

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:
def slove():
    import sys
    input = sys.stdin.readline
    s = list(str(input().rstrip('\n')))
    t = list(str(input().rstrip('\n')))
    s.sort()
    t.sort(reverse=True)
    print("Yes" if s < t else "No")


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC082 B - Two Anagrams
S = input()
T = input()

LS = [s for s in S]
LT = [t for t in T]

LS.sort()
LT.sort(reverse=True)
SS = ''
TT = ''

for ls in LS:
    SS += ls
for lt in LT:
    TT += lt
ans = []

ans.append(SS)
ans.append(TT)

ans.sort()

if SS == TT:
    print('No')
    exit()

print('Yes' if ans[1] == TT else 'No')

Submission status: Accepted

Solution code:
s = sorted(list(input()))
t = sorted(list(input()),reverse= True)
st = sorted([s,t])
if s == t:
    print("No")
elif st[0] == s:
    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:
s1 = list(input())
s2 = list(input())

s1.sort()
s2.sort(reverse=True)


if s1 < s2:print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
s="".join(sorted(list(input())))
t="".join(reversed(sorted(list(input()))))
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)
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)

if len(S) < len(T):
    for i in range(len(S)):
        if S[i] < T[i]:
            print("Yes")
            quit()
        if S[i] > T[i]:
            print("No")
            quit()
    print("Yes")

else:
    for i in range(len(T)):
        if S[i] < T[i]:
            print("Yes")
            quit()
        if S[i] > T[i]:
            print("No")
            quit()
    print("No")

Submission status: Accepted

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

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

li = []
li.append(t)
li.append(s)
li = sorted(li)

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

if li[0] == s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#2019/09/26
s = input()
s = sorted(s)
t = input()
t = sorted(t, reverse=True)
print("Yes" if s<t else "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 = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)

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

Submission status: Accepted

Solution code:
s = input()
t = input()
s_prime = ''.join(sorted(list(s)))
t_prime = ''.join(reversed(sorted(list(t))))
# print(s_prime,t_prime)
box1 = [s_prime,t_prime]
box2 = sorted(box1)
# print(box1,box2)
if box1 != box2 or s_prime == t_prime:
    print('No')
else:
    print('Yes')

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:
s1 = list(input())
s1.sort()
s2 = list(input())
s2.sort(reverse = True)
if ("".join(s1)) < ("".join(s2)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# B - Two Anagrams
s = str(input())
t = str(input())

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

if new_s < new_t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

sl = ''.join(sorted(s))
tl = ''.join(reversed(sorted(t)))

if sl < tl:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
S.sort()
T.sort()
S.reverse()
T.reverse()
for i, s in enumerate(S):
    for j, t in enumerate(T):
        if s < t:
            print('Yes')
            exit()
        if s > t:
            for k, t2 in enumerate(T):
                if s < t2:
                    print('Yes')
                    exit()

if all([x == S[0] for x in S]) \
        and all([x == S[0] for x in T]) \
        and len(S) < len(T):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = input()
a = sorted(a)
b = input()
b = sorted(b)
ml = min(len(a),len(b))
cnt = 0
if min(a) < max(b):
    print("Yes")
    cnt = 1
elif a[0:ml] == b[0:ml]:
    if len(a) < len(b):
        print("Yes")
        cnt = 1
if cnt == 0:
    print("No")

Submission status: Accepted

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

ss=sorted(list(s))
tt=sorted(list(t))[::-1]

print(("No","Yes")["".join(ss)<"".join(tt)])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(str(input()))
s.sort()
t=list(str(input()))
t.sort()
t=t[::-1]
s="".join(map(str,s))
t="".join(map(str,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)
s=''.join(s)
t=''.join(t)
if(s<t):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

print('Yes' if sl < tl else 'No' )

Submission status: Accepted

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

sl = ''.join(sorted(s))
tl = ''.join(reversed(sorted(t)))

if sl < tl:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

s_list = []
[s_list.append(_) for _ in s]

t_list = []
[t_list.append(_) for _ in t]

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

count_list = []
if len(s_list) < len(t_list):
    for i in range(len(s_list)):
        if s_list[i] < t_list[i]:
            print('Yes')
            break
        elif t_list[i] < s_list[i]:
            print('No')
            break
        else:
            count_list.append(True)
    if len(count_list) == len(s_list):
        print('Yes')
else:
    for i in range(len(t_list)):
        if s_list[i] < t_list[i]:
            print('Yes')
            break
        elif t_list[i] < s_list[i]:
            print('No')
            break
        else:
            count_list.append(True)
    if len(count_list) == len(t_list):
        print('No')

Submission status: Accepted

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

s.sort()
t.sort(reverse=True)
s="".join(s)
t="".join(t)
#print(s)
#print(t)

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

Submission status: Accepted

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

a()

Submission status: Accepted

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

s.sort(key =lambda x:x[0])
t.sort(key =lambda x:x[0],reverse =True)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
s.sort()
t = list(input())
t.sort(reverse=True)
test = [t, s]
test.sort()
print("Yes" if test[0] == s and s != t else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
s = "".join(sorted(list(input())))
t = "".join(sorted(list(input()), reverse=True))
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:
# ARC 082 B

def resolve():
  s = input()
  t = input()
  # s: 昇順
  # t: 降順
  ss = sorted(list(s))
  tt = sorted(list(t))
  tt.reverse()

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

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

if s == t:
    print('No')
elif sorted(a)[0] == s:
    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)
l = [s, t]
l.sort()
if s != t and l[0] == s:
  print("Yes")
else: print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=sorted(input())
t=sorted(input(),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:
        if i==min(len(s),len(t))-1 and len(s)<len(t):
            print("Yes")
            break
        elif i==min(len(s),len(t))-1 and len(s)>=len(t):
            print("No")
            break

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 = ''.join(sorted(input().strip()))
T = ''.join(sorted(input().strip(),reverse=True))
print('Yes' if S < T else 'No')

Submission status: Accepted

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

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

t = t[::-1]
if s<t:
    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 = input()
t = input()
s = sorted(s)
t = sorted(t)[::-1]
if s<t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
a=input()
b=input()
 
a=sorted(a)
b=sorted(b)
cnt=0
 
if a==b:
	print("No")
	sys.exit()
 
for i in range(min(len(a),len(b))):
	if a[i]<b[-(i+1)]:
		print("Yes")
		break
	
	elif a[i]==b[-(i+1)]:
		cnt+=1
		continue
		
	else:
		print("No")
		break
		
if cnt==min(len(a),len(b)) and len(a)<len(b):
	print("Yes")
	
elif cnt==min(len(a),len(b)) and len(a)>len(b):
	print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
sandt = [t,s]
if sorted(sandt)==sandt:
    print("No")
else: print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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

s_iter = iter(s)
t_iter = iter(t)

len_s, len_t = len(s), len(t)

for _ in range(min(len_s, len_t)):
    next_s = next(s_iter)
    next_t = next(t_iter)
    if next_s > next_t:
        print('No')
        break
    elif next_s < next_t:
        print('Yes')
        break
else:
    if len_s >= len_t:
        print('No')
    else:
        print('Yes')

Submission status: Accepted

Solution code:
print("Yes" if sorted(input()) < sorted(input(),reverse = True) else "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()
st = []

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

if s == t:
  print('No')
else:
  if st == sorted(st):
    print('Yes')
  else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print('Yes'*(sorted(input())<sorted(input())[::-1])or'No')

Submission status: Accepted

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

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

Submission status: Accepted

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

if s_l < t_l:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a()

Submission status: Accepted

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

  return 0

if __name__ == "__main__":
  main()

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, t = [list(input()) for _ in range(2)]
a = []
s = "".join(sorted(s))
t = "".join(sorted(t, reverse=True))
a.append(s)
a.append(t)
print("Yes" if a == sorted(a) and s != t 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 = list(input())
t = list(input())

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

def solve() :
    flg = True
    for i in range(min(len(s), len(t))) :
        if ord(s[i]) < ord(t[i]) :
            return 'Yes'
        elif ord(s[i]) > ord(t[i]) :
            flg = False
    
    if flg and len(t) > len(s) :
        return 'Yes'
    else :
        return 'No'
    
print(solve())

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


S =  sys.stdin.readline().rstrip()
T =  sys.stdin.readline().rstrip()

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
S=[]
T=[]
for i in range(len(s)):
    S.append(s[i])
for i in range(len(t)):
    T.append(t[i])
S.sort()
T.sort(reverse=True)
ST=[]
ST.append(''.join(S))
ST.append(''.join(T))
ss=ST[0]
tt=ST[1]
ST.sort()
if ST[0]==ss and ST[1]==tt and s!=t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

s_cho=[0]*N
t_cho=[0]*M

for i in range(N):
    s_cho[i]=ord(s[i])

for i in range(M):
    t_cho[i]=ord(t[i])

s_cho.sort()
t_cho.sort(reverse=True)

for i in range(N):
    s[i]=chr(s_cho[i])

for i in range(M):
    t[i]=chr(t_cho[i])

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

Submission status: Accepted

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

def main():
    s = sorted(list(input().strip()), reverse=False)
    t = sorted(list(input().strip()), reverse=True)

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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
s = input()
t = input()
re_s = sorted(s)
re_t = sorted(t, reverse=True)
print("Yes" if re_s < re_t else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = sorted(input())
t = sorted(input())[::-1]
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))

st = [s, t]
st = sorted(st)

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

Submission status: Accepted

Solution code:
s,t=open(0);print("YNeos"["".join(sorted(s[:-1]))>="".join(sorted(t.strip(),reverse=True))::2])

Submission status: Accepted

Solution code:
# ABC082b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

s = input()[:-1]
t = input()[:-1]
print('Yes' if sorted(s) < sorted(t, reverse=True) else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = sorted(list(input())),sorted(list(input()),reverse=True)
print("Yes" if a < b else "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()

def sort_str(x, reverse):
    x = list(x)
    x.sort(reverse=reverse)
    return "".join(x)

print("Yes" if sort_str(s, False) < sort_str(t, True) else "No")

Submission status: Accepted

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

s = sorted(s)
t = sorted(t, reverse = True)
s = ''.join(s)
t = ''.join(t)
arr = [s, t]
if s == t:
  print("No")

elif arr == sorted(arr):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = sorted(input())
t = sorted(input(), reverse=True)
s.append('')
t.append('')
import sys
for i,j in zip(s,t):
    if i < j:
        print('Yes')
        sys.exit()
    elif i > j:
        print('No')
        sys.exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = sorted(input())
b = sorted(input(),reverse=True)
if b>a:
	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:
S = list(input())
T = list(input())

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

Submission status: Accepted

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

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

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

flag = True
for i in range(length):
  if sorted_s[i] == sorted_t[i]:
    pass
  elif sorted_s[i] < sorted_t[i]:
    print('Yes')
    flag = False
    break
  else:
    print('No')
    flag = False
    break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
m=input()
alphabet={'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}
a=[]
for i in range(len(n)):
  a.append(alphabet[n[i]])
a.sort()
b=[]
for i in range(len(m)):
  b.append(alphabet[m[i]])
b.sort(reverse=True)

for i in range(min(len(n),len(m))):
  if a[i]<b[i]:
    print('Yes')
    exit()
if len(n)<len(m):
  for i in range(len(n)):
    if a[i]>b[i]:
      print('No')
      exit()
  print('Yes')
  exit()
print('No')

Submission status: Accepted

Solution code:
def test():
    s = list(input())
    t = list(input())
    n = min(len(s),len(t))
    s.sort(); t.sort(reverse=True)
    for i in range(n):
        if s[i] < t[i]:
            print("Yes")
            return
        elif s[i] > t[i]:
            print("No")
            return
        elif s[i] == t[i]:
            pass
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    test()

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
s, t = [list(input()) for _ in range(2)]
s.sort()
t.sort(reverse=True)

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

Submission status: Accepted

Solution code:
import sys
import  math
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = list(str(input()))
    t = list(str(input()))
    s.sort()
    t.sort(reverse=True)
    flag = False
    for n in range(min(len(s), len(t))):
        if s[n] < t[n]:
            flag = True
            print('Yes')
            break
        elif s[n] == t[n]:
            continue
        else:
            flag = True
            print('No')
            break
    if flag == False:
        if len(s) < len(t):
            print('Yes')
        else:
            print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
sd=sorted(list(s))
td=sorted(list(t), reverse=True)
if(''.join(sd)<''.join(td)):
  print("Yes")
  exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# library
from string import ascii_lowercase as a

# input
S = input()
T = input()

# solution
s = ''.join([a[n] for n in sorted([a.index(e) for e in S])])
t = ''.join([a[n] for n in sorted([a.index(e) for e in T], reverse = True)])

# output
if s < t: res = 'Yes'
else: res = 'No'
print(res)

Submission status: Accepted

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

# solution
if len(set(S + T)) == 1 and len(S) < len(T):
    res = 'Yes'
else:
    res = 'No'
    for s in S:
        for t in T:
            if s < t:
                res = 'Yes'
                break

# output
print(res)

Submission status: Accepted

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