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: Wrong Answer

Solution code:
s=input()
t=input()
S=[]
T=[]
LIST=[]
for i in range(len(s)):
    S.append(s[i])
for j in range(len(t)):
    T.append(t[j])
S.sort()
T.sort()
apple=[]
apple.append(S)
apple.append(T)
print(apple)
apple.sort()
print(apple)
if apple[0]==S and apple[0]!=apple[1]:
    print("Yes")
elif apple[0]==apple[1]:
    print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = sorted(input())
t = sorted(input())
if t > s:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

s.sort()
s=''.join(s)

t.reverse()
t=''.join(t)

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

Submission status: Wrong Answer

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

s.sort()
s=''.join(s)

t.reverse()
t=''.join(t)

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

Submission status: Wrong Answer

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

s.sort()
s=''.join(s)
print(s)

t.reverse()
t=''.join(t)
print(t)

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

Submission status: Wrong Answer

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

for x in s:
    flag = False
    for y in t:
        if x < y:
            print("Yes")
            exit(0)
        elif x == y:
            id = s.index(x)
            s.pop(id)
            id = t.index(y)
            t.pop(id)

            if len(s) == 0 and len(t) > 0:
                print("Yes")
                exit(0)
            else:
                break


print("No")

Submission status: Wrong Answer

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

for x in s:
    for y in t:
        if x < y:
            print("Yes")
            exit(0)
        elif x == y:
            if len(s) < len(t):
                print("Yes")
                exit(0)
print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s2="".join(sorted(s))
t2="".join(sorted(t,reverse=True))
st=sorted([s2,t2])
print("Yes" if  st[0]==s2 else "No")

Submission status: Wrong Answer

Solution code:
ls=list(input())
lt=list(input())
ls.sort()
lt.sort(reverse=True)
s_sorted=''.join(ls)
t_sorted=''.join(lt)
before=[s_sorted,t_sorted]
after=[s_sorted,t_sorted]
after.sort()
if before==after:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

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

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

tl = [sd,td]
if sorted(tl) == tl:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

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

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

tl = [sd,td]
if sorted(tl) == tl:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

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

if s[0] < t[0]:
        print("Yes")
elif s[0] == t[0]:
        if len(s) < len(t):
                print("Yes")
        else:
                print("No")
else:
        print("No")

Submission status: Wrong Answer

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

s_ = ''.join(sorted(s))
t_ = ''.join(reversed(t))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
l = sorted(s)
m = sorted(t,reverse = True)
if s > t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
l = sorted(s,reverse = True)
m = sorted(t,reverse = True)
if s > t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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+1] == b[0:ml+1]:
    if len(a) < len(b):
        print("Yes")
        cnt = 1
if cnt == 0:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()
a = sorted(a)
b = input()
b = sorted(b)
ml = min(len(a),len(b))
cnt = 0
if a[0:ml+1] == b[0:ml+1]:
    if len(a) < len(b):
        print("Yes")
        cnt = 1
else:
    for i in range(ml):
        if a[i] < b[i]:
            print("Yes")
            cnt = 1
            break
if cnt == 0:print("No")

Submission status: Wrong Answer

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

sl = sorted(s)
tl = sorted(t)

out = 'No'

for i in range(0,min(len(s), len(t))):
  if sl[i] < tl[-1*i]:
    out = 'Yes'
    break
  elif sl[i] > tl[-1*i]:
    break

print(out)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

for i in range(min_len):
    if s[i] < t[i]:
        print('Yes')
        exit()
    elif s[i] > t[i]:
        print('No')
        exit()
if s_len == t_len:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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
        else:
            print("No")
            break

Submission status: Wrong Answer

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

sorted(s)
sorted(t)

t = t[::-1]

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

Submission status: Wrong Answer

Solution code:
s=sorted(input())
t=sorted(input(), reverse=True)
print('YES' if s<t else 'NO')

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
if sorted(a) < list(reversed(b)):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
print(sorted(a) < list(reversed(b)))

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

a=input()
b=input()

a=sorted(a)
b=sorted(b)

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)]:
		continue
		
	else:
		print("No")
		break
		
if len(a)<len(b):
	print("Yes")
	
else:
	print("No")

Submission status: Wrong Answer

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)):
	print("Yes")

Submission status: Wrong Answer

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


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)):
	print("Yes")

Submission status: Wrong Answer

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


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
		print()
		continue
		
	else:
		print("No")
		break
		
if cnt==min(len(a),len(b)):
	print("Yes")

Submission status: Wrong Answer

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


for i in range(min(len(a),len(b))):
	if a[-i]>b[i]:
		print("Yes")
		break
	
	elif a[-i]==b[i]:
		cnt+=1
		continue
		
	else:
		print("No")
		break
		
if cnt==min(len(a),len(b)):
	print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

a=input()
b=input()

a=sorted(a)
b=sorted(b)

if a==b:
	print("No")

for i in range(min(len(a),len(b))):
	if a[-i]>b[i]:
		print("Yes")
	
	elif a[-i]==b[i]:
		continue
		
	else:
		print("No")
		break

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

a=input()
b=input()

a=sorted(a)
b=sorted(b)

if a[-1]>b[0]:
	print("Yes")
	
else:
	print("No")

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
print('Yes'*(sorted(input(), reverse=True)<sorted(input(), reverse=True))or'No')

Submission status: Wrong Answer

Solution code:
s1 = input()
t1 = input()

s = list(s1)
t = list(t1)

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

i = 0
while(1):
  if ord(s[i]) < ord(t[i]):
    print('Yes')
    break
  else :
    if i+1 == min(len(s1),len(t1)):
    	print('No')
    	break
    else : i+=1

Submission status: Wrong Answer

Solution code:
s1 = input()
t1 = input()

s = list(s1)
t = list(t1)

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

i = 0
while(1):
  if ord(s[i]) < ord(t[i]):
    print('YES')
    break
  else :
    if i+1 == min(len(s1),len(t1)):
    	print('NO')
    	break
    else : i+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 'No'
    else :
        return 'Yes'
    
print(solve())

Submission status: Wrong Answer

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

sf1 = s[0]
if len(s)>1:
    sf2 = s[1]
tf1 = t[-1]
if len(t)>1:
    tf2 = t[-2]
sres1 = 0
sres2 = 0
tres1 = 0
tres2 = 0
A = "abcdefghijklmnopqrstuvwxyz"
for i,x in enumerate(A):
    if sf1 == x:
        sres1 = i
    if len(s)>1:
        if sf2 == x:
            sres2 = i
    if tf1 == x:
        tres1 = i
    if len(t)>1:
        if tf2 == x:
            tres2 = i
if sres1 < tres1:
    print("Yes")
elif sres1 == tres1 and len(s)>1 and len(t)>1:
    if sres2 < tres2:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

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

sf = s[0]
tf = t[-1]

sres = 0
tres = 0
A = "abcdefghijklmnopqrstuvwxyz"
for i,x in enumerate(A):
    if sf == x:
        sres = i
    if tf == x:
        tres = i
if sres < tres:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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
    
    if same_all:
        if len(s) < len(t):
            ok = True
    
    if ok:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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
    
    if same_all:
        if len(s) < len(t):
            ok = True
    
    if ok:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = sorted(list(input())),list(reversed(list(input())))
print("Yes" if a[0] < b[0] else "No")

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

S = sorted(S)
T = sorted(T, reverse=True)
lst = [''.join(S)] + [''.join(T)]
if lst == sorted(lst):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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('Yse')
  else:
    print('No')

Submission status: Wrong Answer

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

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

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

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

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

Submission status: Wrong Answer

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')
print('No')

Submission status: Wrong Answer

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 (a[i]==b[i] for i in range(len(n))) and len(n)<len(m):
  print('Yes')
  exit()
print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
a= input()
b=input()
print("No" if sorted(a)>=sorted(b) else "Yes")

Submission status: Wrong Answer

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

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

c=[ss,tt]
c=sorted(c)
print(c)

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

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

Submission status: Wrong Answer

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

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

c=sorted([ss,tt])
if c[1]==ss or ss==tt:
  print("No")
  
else:
  print("Yes")

Submission status: Wrong Answer

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

ss=sorted(s)
tt=sorted(t)

c=sorted([ss,tt])
if c[1]==ss or ss==tt:
  print("No")
  
else:
  print("Yes")

Submission status: Wrong Answer

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

ss=sorted(s)
tt=sorted(t)

c=sorted([ss,tt])
if c[0]!=ss or ss==tt:
  print("No")
  
else:
  print("Yes")

Submission status: Wrong Answer

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

ss=sorted(s)
tt=sorted(t)

c=sorted([ss,tt])
if c[0]==ss:
  print("Yes")
  
else:
  print("No")

Submission status: Wrong Answer

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

s = input()
t = input()

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

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

Submission status: Wrong Answer

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]
        print(s,t,sep="\n")
        if s < t:
            check = True
            break
    if check:
       break
if check:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()), reverse = 1)
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print("Yes")
        break
else:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)
    print(L)
    if L[0]==L[1]:
        print("No")
    elif L[0]==Ls:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

Solution code:
s = input()
t = input()
Ls= []
Lt= []
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]==Ls:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = sorted(input())
T = sorted(input(),reverse=True)
print("Yes" if T>S else "N0")

Submission status: Wrong Answer

Solution code:
S = sorted(input())
T = sorted(input(),reverse=True)
print("Yes" if T>S else "N0")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

s.sort()
t.sort()
if len(s)<len(t):
  print('Yes')
else:
  for i in range(min(len(s),len(t))):
    if s[i]==t[i]:
      pass
    if s[i]<t[i]:
      print('Yes')
      break
    else:
      print('No')
      break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s1 = []
t1 = []
for i in range(len(s)):
    s1.append(s[i])

s1 = sorted(s1)

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

t1 = sorted(t1)

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


ans = 'No'

if len(s) < len(t):
	n = len(s)
	lngs = 1
else:
	n = len(t)
	lngs = 0

key = 0 #未判定


for i in range(n):#文字列が違う場合の判定
	if s[i] > t[i]:
		ans = 'Yes'
		key = 1
		break
	elif t[i] < s[i]:
		key = 1
		break

if key == 0 and lngs == 1:#短い方の長さ分の文字列が同じ場合の判定
	ans = 'Yes'

print(ans)

Submission status: Wrong Answer

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

print(s_asc)
print(t_desc)

if s_asc < t_desc:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ss=''.join(sorted(s))#辞書順最小=辞書で一番最初
tt=''.join(sorted(t,reverse=True))#辞書順最大

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

Submission status: Wrong Answer

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]
print("Yes") if max([a,b])==b else print("No")

Submission status: Wrong Answer

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

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


ans = 'NO'

if len(s) < len(t):
	n = len(s)
	lngs = 1
else:
	n = len(t)
	lngs = 0

key = 0 #未判定


for i in range(n):#文字列が違う場合の判定
	if s[i] > t[i]:
		ans = 'YES'
		key = 1
		break
	elif t[i] < s[i]:
		key = 1
		break

if key == 0 and lngs == 1:#短い方の長さ分の文字列が同じ場合の判定
	ans = 'YES'

print(ans)

Submission status: Wrong Answer

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

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


ans = 'NO'

if len(s) < len(t):
	n = len(s)
	lngs = 1
else:
	n = len(t)
	lngs = 0

key = 0 #未判定

for i in range(n):#文字列が違う場合の判定
	if s[i] < t[i]:
		ans = 'YES'
		key = 1
		break
	elif t[i] < s[i]:
		key = 1
		break

if key == 0 and lngs == 1:#短い方の長さ分の文字列が同じ場合の判定
	ans = 'YES'

print(ans)

Submission status: Wrong Answer

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

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

ans = 'NO'

if len(s) < len(t):
	n = len(s)
	lngs = 1
else:
	n = len(t)
	lngs = 0

key = 0 #未判定

for i in range(n):#文字列が違う場合の判定
	if s[i] < t[i]:
		ans = 'YES'
		key = 1
		break
	elif t[i] < s[i]:
		key = 1
		break

if key == 0 and lngs == 1:#短い方の長さ分の文字列が同じ場合の判定
	ans = 'YES'

print(ans)

Submission status: Wrong Answer

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

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

ans = 'NO'

if len(s) <= len(t):
	n = len(s)
	lngs = 1
else:
	n = len(t)
	lngs = 0

key = 0 #文字列が一緒

for i in range(n):#文字列が違う場合の判定
	if s[i] < t[i]:
		ans = 'YES'
		key = 1
		break
	elif t[i] < s[i]:
		key = 1
		break

if key == 0 and lngs == 1:#短い方の長さ分の文字列が同じ場合の判定
	ans = 'YES'

print(ans)

Submission status: Wrong Answer

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

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

key = 0
c = 0
early = 0

if len(s) > len(t):
	n = len(t)
else:
	n = len(s)

for i in range(n):
	if s[i] < t[i]:
		early = 1
		break
	elif s[i] == t[i]:
		c += 1
	else:
		break
		
if early == 1 or c == len(s):
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
ss = ''.join(sorted(input()))
tt = ''.join(reversed(input()))

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

Submission status: Wrong Answer

Solution code:
ss,tt="",""
for i in sorted(input()):
    ss+=i
for j in reversed(input()):
    tt+=j
if ss<tt:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
ss,tt="",""
for i in sorted(input()):
    ss+=i
for j in reversed(input()):
    tt+=j
    
print("Yes" if ss<tt else "No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
s_li = []
for si in s:
    s_li.append(alp.find(si))
t_li = []
for ti in t:
    t_li.append(alp.find(ti))
if max(s_li) < max(t_li):
    print('Yes')
elif set(s_li).issubset(set(t_li)) and len(s_li) < len(t_li):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

if s[-1] <= t[0] and not s[-1] == "z":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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: Wrong Answer

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

flag=False

for i in range(min(len(sl),len(tl))) :
  s=sl[i];t=tl[i]
  if chl.index(s) < chl.index(t) :
    flag=True
    break
if flag :
  print("Yes")
else :
  """
  if chl.index(sl[min(len(sl),len(tl))-1]) <= chl.index(tl[min(len(sl),len(tl))-1]):
    print("Yes")
  else :
    print("No")
    
  """
  if len(sl) < len(tl) :
    print("Yes")
  else :
    print("No")

Submission status: Wrong Answer

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

flag=False

for i in range(min(len(sl),len(tl))) :
  s=sl[i];t=tl[i]
  if chl.index(s) < chl.index(t) :
    flag=True
    break
if flag :
  print("Yes")
else :
  print("No")

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

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

print(c)
print(d)

Submission status: Wrong Answer

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

c = ''.join(sorted(a))
d = ''.join(reversed(b))

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

Submission status: Wrong Answer

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

c = sorted(a)
d = list(reversed(b))

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

Submission status: Wrong Answer

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

c = sorted(a)
d = sorted(b)

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

Submission status: Wrong Answer

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

c = sorted(a)
d = sorted(b)

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

Submission status: Wrong Answer

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

c = sorted(a)
d = list(reversed(b))

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

Submission status: Wrong Answer

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

c = sorted(a)
d = sorted(b)

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

Submission status: Wrong Answer

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

c = sorted(a)
d = sorted(b)

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