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()
t = input()
s_lis = []
t_lis = []
for i in range(len(s)):
    s_lis.append(s[i])
for i in range(len(t)):
    t_lis.append(t[i])
s_lis.sort()
t_lis.sort(reverse = True)

s1 = ""
t1 = ""
for i in range(len(s_lis)):
    s1 += s_lis[i] 
for i in range(len(t_lis)):
    t1 += t_lis[i]
#print(s1, t1)
if s1 < t1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
sd = []
for i in s:
    sd.append(i)
td = []
for j in t:
    td.append(j)
if sorted(sd) < sorted(td, reverse=True):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a= input()
b=input()
print("Yes" if sorted(a)<sorted(b)[::-1] 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:
a = sorted(input())
b = sorted(input())

b.reverse()

mojiA = ''.join(a)
mojiB = ''.join(b)

print("Yes") if mojiA<mojiB else print("No")

Submission status: Accepted

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

Submission status: Accepted

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

s = input()
t = input()

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

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

Submission status: Accepted

Solution code:
s = input()
t = input()
S = ''.join(sorted(s))
T = ''.join(sorted(t, reverse=True))
cnt = 0
if T>S:
    print('Yes')

else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
check = False
for i in range(len(s)):
    s = s[len(s)-1] + s[:len(s)-1]
    for j in range(len(t)):
        t = t[len(t)-1] + t[:len(t)-1]
        if s < t:
            check = True
            break
    if check:
       break
if check:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s, t = (input() for _ in range(2))
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, t = (input() for _ in range(2))
new_s = ''.join(sorted(s))
new_t = ''.join(sorted(t, reverse = True))
lst = sorted([new_s, new_t])
if lst.index(new_s) == 1 or new_s == new_t:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

if len(s)<len(t) and set(s) == set(s)&set(t):
    print("Yes")
else:
    for i in s:
        Ls.append(i)
    Ls = "".join(Ls)
    for i in t:
        Lt.append(i)
    Lt = "".join(Lt)
    L = [Ls,Lt]
    L = sorted(L)
    if L[0]==L[1]:
        print("No")
    elif L[0]==Ls:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)
n=min(len(s),len(t))
flag=False
if s[:n]==t[:n] and len(s)<len(t):
  flag=True
else:
  for i in range(n):
    if ord(s[i])<ord(t[i]):
      flag=True
      break
print(['No','Yes'][flag])

Submission status: Accepted

Solution code:
S = sorted(input())
T = sorted(input(),reverse=True)
print("Yes" if T>S else "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:
# -*- coding: utf-8 -*-

s = input()
t = input()

s_sorted = sorted(s)
t_sorted = list(reversed(sorted(t)))

print('Yes' if s_sorted < t_sorted else 'No')

Submission status: Accepted

Solution code:
s = input()
t = input()
list_s = list(s)
list_s.sort()
list_t = list(t)
list_t.sort(reverse=True)
if "".join(list_s)<"".join(list_t):
  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 = 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_prime = "".join(sorted(list(s)))
t_prime = "".join(sorted(list(t), reverse=True))

if s_prime == t_prime:
  print("No")
elif [s_prime, t_prime] == sorted([s_prime, t_prime]):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

def main():

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    s = input()
    t = input()
    sp = "".join(sorted(list(s)))
    tp = "".join(sorted(list(t), reverse = True))
    if sp < tp:
        return "Yes"
    return "No"

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = "".join(sorted(list(input())))
t = "".join(sorted(sorted(list(input())),reverse=True))
a = list([t, s])
print("Yes" if sorted(a).pop() is 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, t = [input() for _ in range(2)]
print('Yes' if sorted(s) < sorted(t)[::-1] 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:
s, t = [input() for _ in range(2)]
print('Yes' if sorted(s) < sorted(t, reverse=True) 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(map(ord, input()))
t=list(map(ord, input()))
s.sort()
t.sort(reverse=True)
print('Yes' if s<t else 'No')

Submission status: Accepted

Solution code:
s=input()
t=input()
c=""
d=""
lista=list()
sa=sorted(s)
ta=sorted(t,reverse=True)
for i in sa:
    c=c+i
for x in ta:
    d=d+x
lista.append(c)
lista.append(d)
if s==t:
    print("No")
elif lista==sorted(lista):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if len(s)<len(t) and s==t[:len(s)]:
    print("Yes")
else:
    for i in range(min([len(s),len(t)])):
        if s[i]!=t[i]:
            if s[i]<t[i]:
                print("Yes")
            else:
                print("No")
            break
        if i==min([len(s),len(t)])-1:
            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:
s1 = input()
s2 = input()

s1 = sorted(s1)
s2 = sorted(s2)
s2 = s2[::-1]

s1 = "".join(s1)
s2 = "".join(s2)

array = [s1,s2]
exchange = sorted(array)

if array[0]==exchange[0] and s1!=s2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=input()
d=input()
v=sorted(list(map(str,s)))
w=sorted(list(map(str,d)),reverse=True)
a=""
b=""
for i in range(len(s)):
  a += v[i]
for c in range(len(d)):
  b += w[c]
if a==b:
  print("No")
else:
  print("Yes") if max([a,b])==b else print("No")

Submission status: Accepted

Solution code:
s=[s for s in input()]
s.sort()
S=''.join(s)
t=[s for s in input()]
t.sort(reverse=True)
T=''.join(t)
print('Yes' if s<t else '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:
ss = ''.join(sorted(input()))
tt = ''.join(sorted(input(), reverse=True))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
a = [s,t]
a.sort()
#print(a)
if a[0] == s and a[1] != s:
    print("Yes")
else:
    print("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()

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

s.sort()
ss = "".join(s)

t.sort(reverse=True)
tt = "".join(t)

if ss == tt:
  print("No")
  exit()

li=[ss, tt]
li.sort()

if li[0] == ss:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
sdash = "".join(sorted(s))
tdash = "".join(reversed(sorted(t)))
print('Yes' if sdash < tdash 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)
#for i in range(len(s)):
#  if s[i] > t[i]:
#    print("No")
#    break
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)
js = ''.join(s)
jt = ''.join(t)
if js < jt:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

hantei = 0
count = 0

if len(s1) < len(t1):
    for i in range(len(s1)):
        count += 1
        if t1[i] > s1[i]:
            hantei = 1
            break
        elif t1[i] < s1[i]:
            break
        elif count == len(s1):
            hantei = 1
            break

else :
     for i in range(len(t1)):
        if t1[i] > s1[i]:
            hantei = 1
            break
        elif t1[i] < s1[i]:
            break

if hantei == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

temp = [s, t]  
if temp == sorted(temp):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sl=list(input())
tl=list(input())
chara="abcdefghijklmnopqrstuvwxyz"
chl=list(chara)
sl.sort()
tl.sort(reverse=True)
s="".join(sl)
t="".join(tl)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = list(input())
y = list(input())

x.sort()
y.sort(reverse=True)

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

Submission status: Accepted

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

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

if s_sort < t_sort:
    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()
ss = ''.join(sorted(s))
tt = ''.join(sorted(t,reverse = True))
c = [ss,tt]
cc = sorted(c)
if cc[0] == ss and cc[0] != cc[1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 82, B - two anagrams
s = ''.join(sorted(input()))
t = ''.join(sorted(input(), reverse = True))
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

c = ''.join(sorted(a))
d = ''.join(sorted(b, reverse=True))

if c < d:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input().rstrip("\n")
t = input().rstrip("\n")

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

Submission status: Accepted

Solution code:
a = input()
b = input()
A = []
B = []
for i in range(len(a)):
  A.append(a[i])
for j in range(len(b)):
  B.append(b[j])
A.sort()
B.sort()
B.reverse()
aa = ''
bb = ''
for i in range(len(a)):
  aa += A[i]
for j in range(len(b)):
  bb += B[j]
if aa < bb:
  print('Yes')
else:
  print('No')
#print(aa,bb)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
ans = "No"
cnt = 0
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]):
        cnt += 1
if cnt == min(len(s), len(t)) and len(s) < len(t):
    ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
I=lambda:"".join(sorted(list(input())))
print("YNeos"[I()>=I()[::-1]::2])

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

s.sort()
t.sort()

i = 0
j = len(t) - 1
while True:
    if s[i] < t[j]:
        print('Yes')
        exit()
    elif s[i] > t[j]:
        print('No')
        exit()
    else:
        i += 1
        j -= 1
        if j < 0:
            print('No')
            exit()
        if i >= len(s):
            print('Yes')
            exit()

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

Submission status: Accepted

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

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

ans = 'None'

for s_, t_ in zip( s,t ):
  if ord(s_) < ord(t_):
    ans = 'Yes'
    break
  elif ord(s_) > ord(t_):
    ans = 'No'
    break

if ans == 'None':
  if len_s < len_t:
    ans = 'Yes'
  else:
    ans = 'No'
    
print(ans)

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_sort = sorted(s)
t_sort = sorted(t, reverse=True)

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

Submission status: Accepted

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

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

if s_ascending < t_descending:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = "".join(sorted(input()))
t = "".join(sorted((input()))[::-1])
if s < 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(ord(s[i]))
for i in range(len(t)):
	T.append(ord(t[i]))
if min(S)<max(T):
	print("Yes")
elif min(S)>max(T):
	print("No")
else:
	S.sort()
	T.sort()
	for i in range(1,min(len(s),len(t))):
		if S[i]<T[-i-1]:
			print("Yes")
			exit()
		elif S[i]>T[-i-1]:
			print("No")
			exit()
	if len(s)<len(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:
ss = input()
tt = input()
s = "".join(sorted(list(ss)))
t = "".join(sorted(list(tt), reverse = True))
l = sorted([s,t])
if l[0] == l[1]:
    print("No")
elif l[0] == s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
sl = [char for char in s]
tl = [char for char in t]
sl.sort()
tl.sort()
tl.reverse()
ss = ''.join(sl)
tr = ''.join(tl)
if tr > ss:
  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_given = list(input())
t_given = list(input())

s_len = len(s_given)
t_len = len(t_given)
s_sorted = sorted(s_given)
t_sorted = sorted(t_given, reverse=True)

for i in range(t_len):
    if s_sorted[i] < t_sorted[i]:
        print('Yes')
        break
    elif s_sorted[i] > t_sorted[i]:
        print('No')
        break

    #s_sortedとt_sortedが同一の場合にNoと出力するため、この順序でifとelifを書く
    if i == t_len - 1:
        print('No')
        break
    elif i == s_len - 1 :
        print('Yes')
        break

Submission status: Accepted

Solution code:
import random
s_given = list(input())
t_given = list(input())

s_len = len(s_given)
t_len = len(t_given)
s_sorted = sorted(s_given)
t_sorted = sorted(t_given, reverse=True)

for i in range(t_len):
    if s_sorted[i] < t_sorted[i]:
        print('Yes')
        break
    elif s_sorted[i] > t_sorted[i]:
        print('No')
        break
    if i == t_len - 1:
        print('No')
        break
    elif i == s_len - 1 :
        print('Yes')
        break

Submission status: Accepted

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

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

print("Yes" if sdash < tdash else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(s: str, t: str):
    s = "".join(sorted(list(s)))
    t = "".join(sorted(list(t), reverse=True))
    if s < t:
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

"""
'間に挿入する文字列'.join([連結したい文字列のリスト])
発想
sを辞書順で一番早くなるよう並び替え
tを辞書順で一番遅くなるよう並び替え
それらを比較
"""

Submission status: Accepted

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

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

def cond1(s,t):
    n = len(s)
    m = len(t)
    if(n >= m):
        return False
    else:
        for i in range(n):
            if(ord(s[i]) != ord(t[i])):
                return False
        return True

def cond2(s,t):
    m = min(len(s),len(t))
    for i in range(m):
        if(ord(s[i]) < ord(t[i])):
            return True
        elif(ord(s[i]) > ord(t[i])):
            return False
    return False

ans = (cond1(s,t) or cond2(s,t))

if(ans):
    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:
A = "".join((sorted(input())))
B = "".join(sorted(input(), reverse=True))
print("Yes" if A < B else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
s=input()
t=input()
S="".join(sorted(list(s)))
T="".join(sorted(list(t)))[::-1]
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('No')
else:
    print('Yes')

Submission status: Accepted

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

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

n = len(S)
m = len(T)

for i in range(min(n,m)):
    if S[i] > T[i]:
        print('No')
        exit()
    elif S[i] < T[i]:
        print('Yes')
        exit()

if n >= m:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = [i for i in input().strip()]
t = [i for i in input().strip()]

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

#print(s)
#print(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)
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()

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

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

Submission status: Accepted

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

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

if ''.join(sedit) < ''.join(tedit):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

for i in range(len(t)):
  if i > len(s)-1:
    print('Yes')
    exit()
  elif s[i] == t[i]:
    continue
  elif s[i] > t[i]:
    print('No')
    exit()
  else:
    print('Yes')
    exit()
if len(t) > len(s):
  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:
import math

#n = int(input())
#a = int(input())
#n,a,b = list(map(int,input().split(" ")))
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
#a,b = list(input().split())
string1 = input()
string2 = input()
#ls = [int(input()) for i in range(n)]

ls1 = list(string1)
ls1.sort()
string1 = "".join(ls1)
ls2 = list(string2)
ls2.sort(reverse=True)
string2 = "".join(ls2)
if string1 < string2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    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")
            	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
l = []

a = list(input())
a.sort()
a = ''.join(a)
l.append([a,'a'])
b = list(input())
b.sort(reverse=True)
b = ''.join(b)
l.append([b,'b'])

l.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(input())
b = list(input())

a.sort()
b.sort(reverse=True)
print("Yes") if a<b else print("No")

Submission status: Accepted

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

a = sorted(a)
b = sorted(b, reverse=True)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

s.sort()
t.sort()



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

Submission status: Accepted

Solution code:
a = list(input())
b = list(input())
a.sort()
b = sorted(b, reverse=True)
for i in range(min(len(a), len(b))):
    if a[i] < b[i]:
        print("Yes")
        exit()
    elif a[i] > b[i]:
        print("No")
        exit()
if len(a) >= len(b):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
x=list(input())
y=list(input())

x.sort()
y.sort()
y.reverse()

x1=''.join(x)
y1=''.join(y)
if x1<y1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = sorted([i for i in input()])
t = sorted([i for i in input()], reverse=True)

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