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

ls = []
for i in range(len(s)):
    ls.append(ord(s[i]))
lt = []
for i in range(len(t)):
    lt.append(ord(t[i]))
ls.sort()
lt.sort(reverse=True)

if ls[0]<lt[0]:
    print("Yes")
elif ls[0] == lt[0] and lt.count(ls[0])==len(lt) and len(ls)<len(lt):
    print("Yes")
elif ls[0] == lt[0]:
    print("No")
else:
    print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

check_box = sorted([s, t])

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

Submission status: Wrong Answer

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

s_all = "".join(sorted(list(s)))
t_all = "".join(sorted(list(t), reverse=True))
l = sorted([s_all, t_all])
if l[0] == l[1]:
    print("No")
elif l[0] == s_all:
    print("Yes")
else:
    print("no")

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
sl = [char for char in s]
tl = [char for char in t]
sl.sort()
tl.reverse()
ss = ''.join(sl)
tr = ''.join(tl)
if tr > ss:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
sl = [char for char in s]
tl = [char for char in t]
sl.sort()
tl.reverse()
ss = ''.join(sl)
tr = ''.join(tl)
l1 = [ss,tr]
l2=l1.copy()
l2.sort()
if s == t:
  print('No')
elif l1 == l2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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)

print(s_sorted, t_sorted)

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

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

s_len = len(s_given)
t_len = len(t_given)
s_random = random.sample(s_given, s_len)
t_random = random.sample(t_given, t_len)

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

Submission status: Wrong Answer

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

s_len = len(s_given)
t_len = len(t_given)
s_random = random.sample(s_given, s_len)
t_random = random.sample(t_given, t_len)


print(s_random, t_random)

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

Submission status: Wrong Answer

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

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

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

s.sort()
t.reverse()

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

def cond2(s,t):
    m = min(len(s),len(t))
    for i in range(0,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: Wrong Answer

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

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

s.sort
t.sort(reverse=True)

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)

for i in range(len(s)):
    if s[i] < t[i]:
        print("Yes")
        exit()
    if i == len(t)-1:
        break
    
print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = sorted([a for a in input()])
t = sorted([a for a in input()])
if (s[0] < t[-1]) or (s[0] == t[-1] and len(s)<len(t)): print('Yes')
else: print('No')

Submission status: Wrong Answer

Solution code:
s = sorted([i for i in input()])
t = list(reversed([i for i in input()]))

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

Submission status: Wrong Answer

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

Solution code:
s = sorted(list(input()))
t = sorted(list(input()))
ns = len(s)
nt = len(t)
can = True
if(ns<nt):
    can = True
    for i in range(ns):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
else:
    can = False
    for i in range(nt):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
if(can):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()))
ns = len(s)
nt = len(t)
can = True
if(ns<nt):
    for i in range(ns):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
else:
    can = False
    for i in range(nt):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
if(can):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()))
u = set(s) & set(t)
def test(count):
  alp = list("abcdefghijklmnopqrstuvwxyz")
  pos = alp.index(count)
  return pos

if test(s[-1]) > test(t[-1]) :
  print("no")
elif test(s[-1]) < test(t[-1]) :
  print("yes")
elif set(s) == set(t) and (u & set("abcdefghijklmnopqrstuvwxyz")) == set(s[-1]):
  if len(s) < len(t) :
    print("yes")
  else :
    print("no")
else :
  print("yes")

Submission status: Wrong Answer

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

def test(count):
  alp = list("abcdefghijklmnopqrstuvwxyz")
  pos =alp.index(count)
  return pos

if test(s[-1]) > test(t[-1]) :
  print("no")
elif test(s[-1]) < test(t[-1]) :
  print("yes")
elif  set(s) == set(t) :
  if len(s) < len(t) :
    print("yes")
  else :
    print("no")
else :
  print("yes")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
ans = 'No'
if s[0] < t[0]:
    ans = 'Yes'
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A = list(input())
B = list(input())
A.sort()
B.sort(reverse = True)
a = ''.join(A)
b = ''.join(B)
c = [a,b]
c.sort()
if c[0] == a:
    print('Yes')
else: print('No')

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
s_l=[]
t_l=[]

for i in range(len(s)):
    s_l.append(s[i])
    s_l.sort()
for i in range(len(t)):
    t_l.append(t[i])
    t_l.sort(reverse=True)


for i in range(min(len(s),len(t))):   
    
    if ord(s_l[i])>ord(t_l[i]):
        print("No")
        sys.exit()
    elif ord(s_l[i])==ord(t_l[i]):
        pass
    elif ord(s_l[i])<ord(t_l[i]):
        print("Yes")
        sys.exit()
    
if len(s)==len(t):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
s_l=[]
t_l=[]

for i in range(len(s)):
    s_l.append(s[i])
    s_l.sort()
for i in range(len(t)):
    t_l.append(t[i])
    t_l.sort(reverse=True)


for i in range(min(len(s),len(t))):   
    print(s_l,t_l)
    if ord(s_l[i])>ord(t_l[i]):
        print("No")
        sys.exit()
    elif ord(s_l[i])==ord(t_l[i]):
        pass
    elif ord(s_l[i])<ord(t_l[i]):
        print("Yes")
        sys.exit()
    
if len(s)==len(t):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
s_l=[]
t_l=[]

for i in range(len(s)):
    s_l.append(s[i])
    s_l.sort()
for i in range(len(t)):
    t_l.append(t[i])
    t_l.sort(reverse=True)

if len(s)>=len(t):
    print("No")
else:
    for i in range(min(len(s),len(t))):   
        
        if ord(s_l[i])>ord(t_l[i]):
            print("No")
            sys.exit()
        elif ord(s_l[i])==ord(t_l[i]):
            pass
        elif ord(s_l[i])<ord(t_l[i]):
            print("Yes")
            sys.exit()
    
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
s_l=[]
t_l=[]

for i in range(len(s)):
    s_l.append(s[i])
    s_l.sort()
for i in range(len(t)):
    t_l.append(t[i])
    t_l.sort(reverse=True)

if len(s)==len(t):
    print("No")
else:
    for i in range(min(len(s),len(t))):   
        
        if ord(s_l[i])>ord(t_l[i]):
            print("No")
            sys.exit()
        elif ord(s_l[i])==ord(t_l[i]):
            pass
        elif ord(s_l[i])<ord(t_l[i]):
            print("Yes")
            sys.exit()
    
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
 
s_list = list(s)
t_list = list(t)
 
s_list.sort()
t_list.sort()
    
for i in range(min(len(s_list), len(t_list))):
  if s_list[i] < t_list[i]:
    print('Yes')
    break
  elif s_list[i] > t_list[i]:
    print('No')
    break
  else:
    if i == min(len(s_list), len(t_list)):
      if len(s_list) < len(t_list):
        print('Yes')
      else:
        print('No')
    else:
      continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

alph = 'abcdefghijklmnopqrstuvwxyz'
s_idx = -1
t_idx = -1

i = 0
while s_idx == -1:
    if s.count(alph[i]):
        s_idx = i
    i += 1

i = 0
while t_idx == -1:
    if t.count(alph[25-i]):
        t_idx = 25-i
    i += 1

if s_idx < t_idx:
    print('Yes')
elif s_idx > t_idx:
    print('No')
elif s.count(alph[s_idx]) < t.count(alph[t_idx]):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
flag = False
same = True
for i in range(min(len(s), len(t))):
    if(s[i] < t[i]):
        flag = True
        break
    elif(s[i] < t[i]):
        same = False

if (flag):
    print("Yes")
else:
    if(same and len(s) < len(t)):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
flag = False
for i in range(min(len(s), len(t))):
    if(s[i] < t[i]):
        flag = True
        break

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

Submission status: Wrong Answer

Solution code:

s = input()
t = input()

lis_s = list(s)
lis_t = list(t)

lis_s.sort()
lis_t.sort()

ns = []
nt = []

alp = "abcdefghijklmnopqrstuvwxyz"

for i in range(len(alp)):

    while len(lis_s)>0 and lis_s[0] == alp[i]:

        ns.append(i)
        del lis_s[0]

    while len(lis_t)>0 and lis_t[0] == alp[i]:

        nt.append(i)
        del lis_t[0]

#print (ns,nt)

ans = False
flag = True

for i in ns:

    for j in nt:

        if i < j:
            ans = True

for i in ns:

    if i in nt:

        nt.remove(i)

    else:

        flag = False

if flag:

    ans = True

if ans:
    print ("Yes")

else:
    print ("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
s.sort()
t = list(input())
t.sort()
t = t[::-1]
        
for i in range(min(len(s), len(t))):
    if s[i] == t[i]:
        pass
    elif s[i] < t[i]:
        print("Yes")
        break
    elif s[i] > t[i]:
        print("No")
        break
else:
    if len(s) == len(t):
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
s2 = sorted(s)
t2 = sorted(t)

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

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
s2 = sorted(s)
t2 = sorted(t)

if s2 < t2:
    print('yes')
else:
    print('no')

Submission status: Wrong Answer

Solution code:
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)

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

Submission status: Wrong Answer

Solution code:
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
schar=[]
tchar=[]
for i in range(len(s)):
  schar.append(ord(s[i]))
for i in range(len(t)):
  tchar.append(ord(t[i]))
schar.sort()
tchar.sort(reverse=True)
flag=0
for i in range(min(len(s),len(t))):
  if schar[i]>tchar[i]:
    flag=1
    break
if flag==1:
  print("No")
else:
  if len(s)>=len(t):
    print("No")
  else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
s = sorted(input())
t = sorted(input(),reverse=True)
N = min(len(s),len(t))

for i in range(N):
    if s[i] > t[i]:
        print('No')
        sys.exit()
    elif s[i] < t[i]:
        print('Yes')
        sys.exit()
if len(s) < len(t):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
s = sorted(input())
t = sorted(input(),reverse=True)
N = min(len(s),len(t))

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

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
t = sorted(list(input()))
s_sorted = "".join(s)
t_sorted = "".join(t)

if s_sorted < t_sorted:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def main():
    a = list(input())
    a.sort()
    a = ''.join(a)
    b = list(input())
    b.sort(reverse=True)
    b = ''.join(b)
    ans = [a, b]
    ans .sort()
    # print(a, b)
    if ans[0] == a:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
S = "".join(sorted(s)) #str型の文字列にsorted関数を使用するとリストが得られる
t = input()
T = "".join(sorted(t))
if S < T:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def solve():
    s = input()
    t = input()

    s = list(s)
    s.sort(reverse=True)
    s2 = ""
    for moji in s:
        s2 += moji

    t = list(t)
    t.sort(reverse=True)
    t2 = ""
    for moji in t:
        t2 += moji
    
    if s2 < t2:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
from sys import stdin
s = "".join(sorted(list(stdin.readline().rstrip())))
t = "".join(sorted(list(stdin.readline().rstrip())))
if s < t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

l = []
l.append(list(sorted(s)))
l.append(list(reversed(t)))

ans = []
ans.append("".join(l[0]))
ans.append("".join(l[1]))

ans2 = list(sorted(ans))

if ans[0] == ans[1]:
    print("No")
elif ans[0] == ans2[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

from functools import reduce 

ss = input()
st = input()


ls = [c for c in ss]
lt = [c for c in st]

#print(ls)


ls.sort()
lt.sort(reverse = True)

ans_s = reduce( lambda x,y: x+y, ls,'' )
ans_t = reduce(lambda x, y: x+y, lt)


print((ans_s, ans_t))
#ans_s.
print( 'Yes' if ans_s < ans_t else 'No' )

Submission status: Wrong Answer

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

alpha = {"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}
s_min_num = 1
t_min_num = 1
s_max_num = 1
t_max_num = 1
for c in s:
    s_min_num = min(s_min_num, alpha[c])
    s_max_num = max(s_min_num, alpha[c])
    
for c in t:
    t_min_num = min(t_min_num, alpha[c])
    t_max_num = max(t_min_num, alpha[c])
    
res = ""
if len(s) < len(t):
    if s_max_num <= t_max_num:
        res = "Yes"
    else:
        res = "No"
elif len(s) == len(t):
    if s_max_num < t_max_num:
        res = "Yes"
    else:
        res = "No"
else:
    if s_max_num < t_max_num:
        res = "Yes"
    else:
        res = "No"
print(res)

Submission status: Wrong Answer

Solution code:
s = [i for i in input()]
t = [j for j in input()]
s.sort()
t.sort(reverse=True)
flag = False

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

Submission status: Wrong Answer

Solution code:
s = sorted(str(input()))
t = sorted(str(input()), reverse=True)
if len(s) != len(t) and s[-1] == t[0]:
        print("Yes")
else:
        print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s_list=[s[i] for i in range(len(s))]
t_list=[t[j] for j in range(len(t))]
s_list.sort()
t_list.reverse()
ss=""
for k in range(len(s_list)):
    ss+=s_list[k]
tt=""
for l in range(len(t_list)):
    tt+=t_list[l]
if ss<tt:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()
    t = input()

    for i in s:
        for j in t:
            if ord(i)< ord(j):
                print('Yes')
                return
    
    print('No')

solve()

Submission status: Wrong Answer

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

if s[0] < t[-1]:
  print("Yes")
elif s[0] > t[-1]:
  print("No")
else:
  if "".join(s) in "".join(t):
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    s1 = [ord(s) - ord('a') for s in S]
    t1 = [ord(t) - ord('a') for t in T]

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

    print(s1, t1)

    for i, j in zip(s1, t1):
        if i < j:
            print('Yes')
            return

    if (len(s1) < len(t1)) & (i > j):
        print('No')
        return
    elif (len(s1) < len(t1)):
        print('Yes')
        return

    print('No')
    
main()

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

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

ls = len(s)
lt = len(t)

p='Yes'
for i in range(100):
  if len(t)<=i:
    p = 'No'
    break
  if len(s)<=i:
    p = 'Yes'
    break 
  if s[i:i+1] > t[i:i+1]:
    p = 'No'
    break
  elif s[i:i+1] < t[i:i+1]:  
    p = 'Yes'
    break
   
print(p)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

s_list = []
for i in range(len(s)):
    s_list.append(s[i])
s_list.sort()

t_list = []
for i in range(len(t)):
    t_list.append(t[i])
t_list.sort()
t_list.reverse()


counter = 0
if len(s) > len(t):
    for i in range(len(t)):
        if s_list[i] < t_list[i]:
            print("Yes")
            exit()
        elif s_list[i] == t_list[i]:
            counter += 1
    if counter == len(t):
        print("Yes")
        exit()
elif len(s) < len(t):
    for i in range(len(s)):
        if s_list[i] < t_list[i]:
            print("Yes")
            exit()
        elif s_list[i] == t_list[i]:
            counter += 1
    if counter == len(s):
        print("Yes")
        exit()
else:
    for i in range(len(s)):
        if s_list[i] < t_list[i]:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

s_list = []
for i in range(len(s)):
    s_list.append(s[i])
s_list.sort()

t_list = []
for i in range(len(t)):
    t_list.append(t[i])
t_list.reverse()

counter = 0
if len(s) > len(t):
    for i in range(len(t)):
        if s_list[i] < t_list[i]:
            print("Yes")
            exit()
        elif s_list[i] == t_list[i]:
            counter += 1
    if counter == len(t):
        print("Yes")
        exit()
elif len(s) < len(t):
    for i in range(len(s)):
        if s_list[i] < t_list[i]:
            print("Yes")
            exit()
        elif s_list[i] == t_list[i]:
            counter += 1
    if counter == len(s):
        print("Yes")
        exit()
else:
    for i in range(len(s)):
        if s_list[i] < t_list[i]:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

xnew = sorted(x)
xnew = ''.join(xnew)

ynew = sorted(y)
ynew = ''.join(ynew)

if xnew < ynew:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
#coding:UTF-8
s = list(input())
t = list(input())
s.sort()
t.reverse()
s="".join(s)
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()
t.sort(reverse=True)
for i in range(100):
    if bool(s[i:i+1]) == False:
        if t[i:i+1]:
            print("Yes")
            break
        else:
            print("No")
            break
    elif bool(t[i:i+1]) == False:
        print("No")
        break
    elif (s[i] < t[i]):
        print("Yes")
        break
    elif (s[i] > t[i]):
        print("No")
        break

Submission status: Wrong Answer

Solution code:
#sを昇順、tを降順で並び替え
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
#1文字目から文字列比較
#sが早い or sが文字無tが文字有の場合終了、判定Yes
#同じ場合次の文字判定へ
#sが遅い or sが文字有tが文字無 or s,t共に文字無の場合終了、判定No
for i in range(100):
    if bool(s[i:2]) == False:
        if t[i:2]:
            print("Yes")
            break
        else:
            print("No")
            break
    elif bool(t[i:2]) == False:
        print("No")
        break
    elif (s[i] < t[i]):
        print("Yes")
        break
    elif (s[i] > t[i]):
        print("No")
        break

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for i in range(100):
    if bool(s[i:2]) == False:
        if t[i:2]:
            print("Yes")
            break
        else:
            print("No")
            break
    elif bool(t[i:2]) == True:
        print("Yes")
        break
    elif (s[i] < t[i]):
        print("Yes")
        break
    elif (s[i] > t[i]):
        print("No")
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n=input()
m=input()
lnm=list(n)
lm=list(m)
for i in lm:
  lnm.append(i)
lnms=sorted(lnm)
lms=sorted(lm)
b=False
for i in range(len(lm)):
  if lms[i]!=lnms[i]:
    b=True
    print("Yes")
    break
if not b:
  print("No")

Submission status: Wrong Answer

Solution code:
a=input()
m=[a[i] for i in range(len(a))]
b=input()
n=[b[i] for i in range(len(b))]
m.sort()
n.sort(reverse=1)
i=0
while 1>0:
  if i==len(b):
    print("No")
    break
  if i==len(a):
    print("Yes")
    break
  if m[i]<n[i]:
    print("Yes")
    break
  i+=1