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:
import sys
s = sorted(list(str(input())))
t = sorted(list(str(input())), reverse = True)
u = min(len(s), len(t))
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print('Yes')
        sys.exit()
    if s[i] > t[i]:
        print('No')
        sys.exit()
if s[0:u] == t[0:u] and len(s) < len(t):
    print('Yes')
elif s[0:u] == t[0:u] and len(s) >= len(t):
    print('No')

Submission status: Accepted

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


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

a = []
a.append(s)
a.append(t)

if a == sorted(a) and s != t:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
s_dash = sorted(s)
#print(s_dash)

t = input()
t_dash = sorted(t, reverse=True)
#print(t_dash)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)
print('Yes' if s<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:
# coding: utf-8

s = input().rstrip()
t = input().rstrip()

s_dash = "".join(sorted(s))
t_dash = "".join(reversed(sorted(t)))

print("Yes" if s_dash < t_dash else "No")

Submission status: Accepted

Solution code:
s  =input()
S = []
for c in s:
  S.append(c)
t = input()
T = []
for c in t:
  T.append(c)

S.sort()
s= ''.join(S)
T.sort(reverse=True)
t= ''.join(T)

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

Submission status: Accepted

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


d ={chr(i):i for i in range(97, 97+26)}

s = [d[i]for i in s]
t = [d[i]for i in t]

def check(s,t):
  if (len(s) == 0 )& (len(t)>0) :
    return 'Yes'
  elif (len(t) == 0 )& (len(s)>=0) :
    return 'No'
  a,b = min(s), max(t)
  if a< b:
    return 'Yes'
  elif a==b :
    return a
  else :
    return 'No'
    
while True :
  x = check(s,t)
  if type(x)== int :
    s.remove(x)
    t.remove(x)
  else :
    break
print(x)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    t = input()
    s = input()

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

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

Submission status: Accepted

Solution code:
#082_B
s=sorted(list(input()))
t=sorted(list(input()))[::-1]
print('Yes' if "".join(s)<"".join(t) else 'No')

Submission status: Accepted

Solution code:

def Two_Anagrams(s , t):

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

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

    if not ans and len(s) >= len(t):
        ans = "No"
    elif not ans:
        ans = "Yes"

    return ans

def main():
    s = list(str(input()))
    t = list(str(input()))
    print(Two_Anagrams(s , t))

if __name__ == '__main__':
    main()

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 = ''.join(sorted(input()))
t = ''.join(sorted(input(), reverse=True))

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

Submission status: Accepted

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

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

import sys
N = min(len(sorted_s),len(sorted_t))

for i in range(N):
    if ord(sorted_s[i]) < ord(sorted_t[i]):
        print('Yes')
        sys.exit()
    elif ord(sorted_s[i]) > ord(sorted_t[i]):
        print('No')
        sys.exit()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
T=input()
S=sorted(S)
T=sorted(T,reverse=True)
print('Yes' if 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 = "".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())

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

ans = ["No", "Yes"]

# print(s)

flag = 0
for i in range(min(len(s), len(t))):
    if (s[i] < t[i]):
        flag = 1
        break
    elif (s[i] > t[i]):
        flag = 2
        break

if (len(s) < len(t)and flag == 0):
    flag = 1

print(ans[flag == 1])

Submission status: Accepted

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

for cs in s:
    for ct in t:
        if cs < ct:
            print('Yes')
            exit()

if len(s) < len(t) and len(set(s)) == 1 and len(set(t)) == 1:
    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)

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

ans = False

for i in range(min_len):
    if s[i] < t[i]:
        ans = True
        break

if s[:min_len] == t[:min_len]:
    if len(s) < len(t):
        ans = True
        
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = sorted(list(input()))
t = sorted(list(input()), reverse=True)
if s == t:
    print('No')
    exit()
sd = ''.join(s)
td = ''.join(t)
l = [sd, td]
ls = sorted(l)
if l == ls:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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

x = sorted(["".join(s), "".join(t[::-1])])
if "".join(s)==x[0] and s != t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

print('Yes' if S_<T_ else '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 = input()
t = input()
s = sorted(s)
t = sorted(t, reverse=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=1))
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
if s==t:
    print('No')
    exit()

s = sorted(s)
s = ''.join(s)
t = sorted(t, reverse=1)
t = ''.join(t)
l = [s,t]
k = sorted(l)
if l==k:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
sLst, tLst = list(input()), list(input())
sLst.sort()
tLst.sort(reverse=True)

sd = ''.join(sLst)
td = ''.join(tLst)

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

Submission status: Accepted

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

S_list = []
T_list = []
for _ in S:
  S_list.append(_)
for _ in T:
  T_list.append(_)

S_list.sort()
T_list.sort(reverse=True)

S=''
T=''
for _ in S_list:
  S+=_
for _ in T_list:
  T+=_


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


print(ans)

Submission status: Accepted

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

a=[]
b=[]

for i in range(len(s)):
  a.append(s[i])
  
for i in range(len(t)):
  b.append(t[i])
  

a.sort()
b.sort(reverse=True)

if a < b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=sorted(str(input()))
t=sorted(str(input()))
t.reverse()
l=[s,t]
lis=sorted(l)
if s==t:
  print('No')
else:
  if l==lis:
    print('Yes')
  else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

if sol < tol: 
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
#print(s,t)

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

Submission status: Accepted

Solution code:
s= list(input())
t= list(input())
ss=sorted(s)
tt=sorted(t,reverse=True)
sss=''.join(ss)
ttt=''.join(tt)
ans = []
ans.append(sss)
ans.append(ttt)
ans1=sorted(ans,key=str.lower)
if ans1[0]==ans[1]:
    print('No')
elif ans1[0]==sss:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
s_d = ""
for i in range(len(s)) :
    s_d += s[i]
t_d = ""
for i in range(len(t)) :
    t_d += t[i]
print("Yes" if s_d < t_d else "No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = [x for x in input()]
t = [x for x in input()]
s.sort()
t.sort(reverse=True)
s, t = "".join(s), "".join(t)
ans = "No"
m = min(len(s), len(t))
for i in range(m):
    if s[i] < t[i]:
        ans = "Yes"
        break
if ans == "No" and s[:m] == t[:m] and len(s) < len(t): ans = "Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
x=list(input())
x.sort()
y=list(input())
y.sort(reverse=True)
print(["No", "Yes"][x<y])

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
slist = [ord(i) for i in s]
tlist = [ord(i) for i in t]
slist.sort()
tlist.sort(reverse=True)

lim=0
if len(s)>len(t):lim = len(t)
else:lim = len(s) 

for i in range(lim):
  if slist[i]<tlist[i]:
    print("Yes")
    exit()
  elif slist[i]>tlist[i]:
    print("No")
    exit()
if len(t)>len(s):
  print("Yes")
  exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
list_s = list(input())
list_t = list(input())

list_s.sort()
list_t.sort(reverse = True)

if list_s < list_t :
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
alf = 'abcdefghijklmnopqrstuvwxyz'
r = 'No'
if len(s)<len(t) and s==t[:len(s)]:
    r = 'Yes'

s = sorted(s)
t = sorted(t, reverse=True)
for i in range(min(len(s),len(t))):
    si = alf.index(s[i])
    ti = alf.index(t[i])
    if si < ti:
        r = 'Yes'
        break
    elif si == ti:
        continue
    else:
        break
print(r)

Submission status: Accepted

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

ans = 'No'

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

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 = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()), reverse=True))

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

Submission status: Accepted

Solution code:
# coding: utf-8
s=list(input())
t=list(input())

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
sd = "".join(s)
td = "".join(t)
print("Yes" if sd < td else "No")

Submission status: Accepted

Solution code:
s = input()
t = input()
flag = False
for i in range(len(s)):
  for j in range(len(t)):
    if s[i] < t[j]:
      flag = True

if s in t and len(s) < len(t):
  flag = True

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

Submission status: Accepted

Solution code:
s = input()
t = input()
s = sorted(s)
t = sorted(t, reverse=True)
u = min(len(s), len(t))
if s == t:
    print("No")
    exit()
if len(s) < len(t) and s == t[:len(s)]:
    print("Yes")
    exit()
else:
    for i in range(u):
        if s[i] > t[i]:
            print("No")
            exit()
        elif s[i] == t[i]:
            pass
        else:
            print("Yes")
            exit()
    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()

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

Submission status: Accepted

Solution code:
from collections import Counter

def solve(s, t):
    sc = sorted(s)
    tc = sorted(t, reverse=True)
    return 'Yes' if sc < tc else 'No'

_s = input()
_t = input()
print(solve(_s, _t))

Submission status: Accepted

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

for s, t in zip(sorted(S), sorted(T, reverse=True)):
    if s < t:
        print('Yes')
        break
    elif s > t:
        print('No')
        break
else:
    print('Yes' if len(S) < len(T) else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
t = input()
ret = sorted(s) < sorted(t, reverse=True)
print('Yes' if ret else '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(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=list(input())
t=list(input())
t.sort(reverse=True)
tt=sorted(t)
t=''.join(t)
tt=''.join(tt)
s.sort()
s=''.join(s)
dic=[s,t]
dic.sort()
if dic[0]==s and tt!=s:
	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()
S=[s[c] for c in range(len(s))]
S.sort()
t=input()
T=[t[d] for d in range(len(t))]
T.sort(reverse=True)


print(["No","Yes"][(S<T)])

Submission status: Accepted

Solution code:
s = input()
t = input()
sList = sorted(s)
tList = sorted(t, reverse=True)
num = min(len(s), len(t))
for i in range(num):    
    if sList[i] == tList[i]:
        continue
    if sList[i] < tList[i]:
        flag = True
        break
    if sList[i] > tList[i]:
        flag = False
        break
try: 
    if flag:
        print("Yes")
    else:
        print("No")
except NameError as flag:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(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)
a=''.join(s)
b=''.join(t)
if a==b:
  print('No')
  exit()
tmp=sorted([a, b])
if tmp[0]==a:
  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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = list(input())
    T = list(input())
    S.sort()
    T.sort(reverse=True)
    print('Yes'if S < T else 'No')


if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
try:
    s = input()
    t = input()
    s_ = sorted(s)
    t_ = sorted(t, reverse=True)
    print('Yes' if s_<t_ else 'No')
except EOFError:
    pass

Submission status: Accepted

Solution code:
def qsort(array):
    if len(array) < 2:
        return array
    else:
        pivot = array[0]
        less = [i for i in array[1:] if i <= pivot]
        greater = [i for i in array[1:] if i > pivot]
        return qsort(less) + [pivot] + qsort(greater)

si = input()
ti = input()

s_sort = qsort(si)
t_sort = qsort(ti)

s = ''
t = ''

for i in s_sort:
    s += i
for i in t_sort[::-1]:
    t += i
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
rev_s = "".join(sorted(input(),reverse=False))
rev_t = "".join(sorted(input(),reverse=True))
# print(rev_s)
# print(rev_t)
if rev_t > rev_s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

S = []
T = []
for i in s:
    S.append(i)
for j in t:
    T.append(j)
S = sorted(S)
T = list(reversed(sorted(T)))

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

Submission status: Accepted

Solution code:
print('YNeos'[sorted(input())>=sorted(input())[::-1]::2])

Submission status: Accepted

Solution code:
s = sorted(input())
t = sorted(input())[::-1]
print('YNeos'[s>=t::2])

Submission status: Accepted

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

Submission status: Accepted

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

for i, j in zip(s, t):
  if i < j:
    print("Yes")
    break
  elif i > j:
    print("No")
    break
else:
        if 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)
s=''.join(s)
t=''.join(t)
if t>s:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s=[i for i in input()]
t=[i for i in input()]
s1="".join(sorted(s))
t1="".join(sorted(t)[::-1])
if s1>=t1:print("No")
else:print("Yes")

Submission status: Accepted

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

for i, j in zip(s, t):
  if i < j:
    print("Yes")
    break
  elif i > j:
    print("No")
    break
else:
  if len(s) < len(t):
    print("Yes")
  else:
    print("No")

Submission status: Accepted

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

# print('s t', s, t)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def main(I):
    #並び替え
    I[0].sort()
    I[1].sort(reverse = True)
    if str(I[0]) == str(I[1]):
        return False
    else:
        return str(I[0]) == str(sorted(I)[0])

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

Submission status: Accepted

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

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

ans=sorted([s,t])

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

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

if __name__ == '__main__':
    main()

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()
slist=[s[i] for i in range(len(s))]
tlist=[t[i] for i in range(len(t))]
slist.sort()
tlist.sort(reverse=True)
s_new=""
t_new=""
for i in range(len(slist)):
  s_new += slist[i]
for i in range(len(tlist)):
  t_new += tlist[i]
if s_new < t_new:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

s_ = ''
t_ = ''

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
flag=0
l1=list(s)
l2=list(t)
l1.sort()
l2.sort(reverse=True)
#print(l1,l2)
minlen=min(len(l1),len(l2))
for i in range(minlen):
    if (l1[i]<l2[i]):
        flag=1
        break
    if (l1[i]>l2[i]):
        flag=-1
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

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

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

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
# print(s)
# print(t)
sd=sorted(s)
td=sorted(t,key=lambda x:x[-1], reverse=True)
# print(sd)
# print(td)
if sd < td:
    print('Yes')
else:
    print(('No'))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
t = input()
list_s = []
list_t = []
for i in range(len(s)):
    list_s.append(s[i])
for i in range(len(t)):
    list_t.append(t[i])
list_s.sort()
list_t.sort()
for i in range(len(s)):
    if list_s[i] < list_t[-i-1]:
        print("Yes")
        exit(0)
    elif list_s[i] > list_t[-i-1]:
        print("No")
        exit(0)
    elif i == len(t)-1:
        if i < len(s):
            print("No")
        else: print("Yes")
        exit(0)
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

lst2.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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