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:
import random
s=list(input())
t=list(input())
random.shuffle(s)
random.shuffle(t)
S=''.join(s)
T=''.join(t)
L=[S,T]
L.sort()
if T==S:
  print('No')
elif L[0]==S:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import random
s=list(input())
t=list(input())
random.shuffle(s)
random.shuffle(t)
S=''.join(s)
T=''.join(t)
L=[S,T]
L.sort()
if L[0]==S:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import random
s=list(input())
t=list(input())
random.shuffle(s)
random.shuffle(t)
k=[''.join(s),''.join(t)]
k.sort()
print(k[0])

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:
a = input()
b = input()

aa = []
for i in range(len(a)):
    aa.append(ord(a[i]))
#print(aa)
aa.sort()
#print(aa)
ansa = ""
for i in range(len(a)):
    ansa += chr(aa[i])
#print(ansa)

bb = []
for i in range(len(b)):
    bb.append(ord(b[i]))
#print(bb)
bb.sort()
bb.reverse()
#print(bb)
ansb = ""
for i in range(len(b)):
    ansb += chr(bb[i])
#print(ansb)

ans = "No"
for i in range(min(len(ansa),len(ansb))):
    if ansa[i] < ansb[i]:
        ans = "Yes"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
#82b
s=sorted(list(input()))
t=sorted(list(input()))

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

ans=sorted([tt,ss])

if ss==tt:
    print('No')
else:
    print(['No','Yes'][ans[0]==ss])

Submission status: Wrong Answer

Solution code:
#82b
s=sorted(list(input()))
t=sorted(list(input()))

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

ans=sorted([tt,ss])

if ss==tt:
    print('NO')
else:
    print(['No','Yes'][ans[0]==ss])

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

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

ans = sorted([tt,ss])
print(['No', 'Yes'][ans[0] == ss])

Submission status: Wrong Answer

Solution code:
s=input();t=input()
for i in s:
    for j in t:
        if j>i:
            print("Yes")
            quit()
    if len(s)<len(t):
        print("Yes")
        quit()
print("No")

Submission status: Wrong Answer

Solution code:
s=input()
lists=[]
for i in range(len(s)):
    lists.append(s[i])
    
t=input()
listt=[]
for j in range(len(t)):
    listt.append(t[j])
    
lists.sort()
listt.sort(reverse=True)

list1=[lists,listt]
list1.sort()
if list1[0]==lists:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

s = input()
t = input()

tmp = list(s)
tmp.sort()
s_ = "".join(tmp)

tmp = list(t)
tmp.sort(reverse=True)
t_ = "".join(tmp)

for s_i_, t_i_ in zip(s_, t_):
    if ord(s_i_) < ord(t_i_):
        print("Yes")
        sys.exit()
print("No")

Submission status: Wrong Answer

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

tmp = list(s)
tmp.sort()
s_ = "".join(tmp)

tmp = list(t)
tmp.sort(reverse=True)
t_ = "".join(tmp)

st_ = [s_, t_]
st_.sort()

print("Yes" if st_[0] == s_ else "No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

t = list(t)
t.sort()
t.reverse()
t = "".join(t)

l = [s, t]
if l == sorted(l):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s1,s2 = input(),input()
l = list()
s1_ = len(s1)
s2_ = len(s2)

S1,S2 = str(),str()

for i in s1:
    l.append(i)
l.sort()
S1 = "".join(l)

l = list()

for i in s2:
    l.append(i)
l.sort()
l = l[::-1]
S2 = "".join(l)


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s_list = list(input())
t_list = list(input())

# 昇順ソート
s_list.sort()
# 降順ソート
t_list.sort(reverse=True)

# 文字列の並び順も比較演算子で大小比較できる
if "".join(s_list) < "".join(t_list):
    print("yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ans = 0
for i in range(len(s)):
    for j in range(len(t)):
        if(s[i] < t[j]):ans = 1
if ans:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
S = []
T = []

for i in range(len(s)):
    S.append(s[i])
    
for i in range(len(t)):
    T.append(t[i])
    
S.sort()
T.sort()

if min(S, T) == S:
    print('Yes')

else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
S = []
T = []

for i in range(len(s)):
    S.append(s[i])
    
for i in range(len(t)):
    T.append(t[i])
    
S.sort()
T.sort()

if min(S, T) == T:
    print('Yes')

else:
    print('No')

Submission status: Wrong Answer

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

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

ss = ""
for i in range(len(s)):
    ss = ss + S[i]


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

tt = ""
for i in range(len(t)):
    tt = tt + T[i]



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

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.reverse()
k = 0
for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
        k = 1
        break
    elif s[i] > t[i]:
        break

if len(set(s))==1 and len(set(t)) ==1 :
    if len(s) < len(t) and s[0] <= t[0]:
        k = 1
print(('No','Yes')[k == 1])

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.reverse()
k = 0
for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
        k = 1
        break
    elif s[i] > t[i]:
        break

if len(set(s))==1 and len(set(t)) ==1 :
    if len(s) < len(t):
        k = 1
print(('No','Yes')[k == 1])

Submission status: Wrong Answer

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

e = dict()
e[1] = 'a'
e[2] = 'b'
e[3] = 'c'
e[4] = 'd'
e[5] = 'e'
e[6] = 'f'
e[7] = 'g'
e[8] = 'h'
e[9] = 'i'
e[10] = 'j'
e[11] = 'k'
e[12] = 'l'
e[13] = 'm'
e[14] = 'n'
e[15] = 'o'
e[16] = 'p'
e[17] = 'q'
e[18] = 'r'
e[19] = 's'
e[20] = 't'
e[21] = 'u'
e[22] = 'v'
e[23] = 'w'
e[24] = 'x'
e[25] = 'y'
e[26] = 'z'

s = input()
t = input()
lists = []
listt = []
for i in range(len(s)):
	lists.append(d[s[i]])
for i in range(len(t)):
	listt.append(d[t[i]])
lists.sort()
listt.sort()
listt.reverse()
check = True
for i in range(len(s)):
	if i < len(listt):
		if lists[i] < listt[i]:
			check = True
			break
		elif lists[i] > listt[i]:
			check = False
			break
		else:
			if i != len(s)-1:
				check = True
			else:
				check = False
if check:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

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

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

T = []
for j in range(len(t)):
    T.append(t[j])

S.sort()
T.sort()

ss = ""
for i in range(len(s)):
    ss = ss + S[i]
    
tt = ""
for j in range(len(t)):
    tt = tt + T[j]



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

Submission status: Wrong Answer

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

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

T = []
for j in range(len(t)):
    T.append(t[j])

S.sort()
T.sort()

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

Submission status: Wrong Answer

Solution code:
s = input()
b = input()
S = [ord(s[i]) for i in range(len(s))]
B = [ord(b[i]) for i in range(len(b))]
setS = set(S)
setB = set(B)
onlyS = [setS - (setS & setB)]
onlyB = [setB - (setS & setB)]

if s == b:
    print("No")
elif max(S) > max(B):
    print("No")
elif max(onlyS) >max(onlyB):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
b = input()
S = [ord(s[i]) for i in range(len(s))]
B = [ord(b[i]) for i in range(len(b))]

if s == b:
    print("No")
elif max(S) > max(B):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

if s == b:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
len_result = False
for (f, s) in zip(first, second):
  if f < s:
    result = True
    break
  elif f > s:
    result = False
    break
  else:
    len_result = True

if length and len_result or result:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
for (f, s) in zip(first, second):
  if f < s:
    result = True
    break
  elif f > s:
    result = False
    break
  else:
    result = True

if length and result:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
for (f, s) in zip(first, second):
  if f < s:
    result = True
    break

if length and result:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s=list(str(input()))
t=list(str(input()))
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range (len(s)):
    for j in range (len(alphabet)):
        if s[i]==alphabet[j]:
            s[i]=j
for k in range (len(t)):
    for l in range (len(alphabet)):
        if t[k]==alphabet[l]:
            t[k]=l
if len(s)>len(t):
    lst=[-1]*(len(s)-len(t))
    t=t+lst

if len(t)>len(s):
    lst=[-1]*(len(t)-len(s))
    s=s+lst
import sys
for i in range (len(s)):
    if min(s)<max(t):
        print ('Yes')
        sys.exit()
    elif min(s)>max(t):
        print ('No')
        sys.exit()
    else:
        if min(s)==max(t):
            s.remove(min(s))
            t.remove(max(t))
print ('No')

Submission status: Wrong Answer

Solution code:
s=list(str(input()))
t=list(str(input()))
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range (len(s)):
    for j in range (len(alphabet)):
        if s[i]==alphabet[j]:
            s[i]=j
for i in range (len(t)):
    for j in range (len(alphabet)):
        if t[i]==alphabet[j]:
            t[i]=j
if len(s)>len(t):
    lst=[-1]*(len(s)-len(t))
    t=t+lst

if len(t)>len(s):
    lst=[-1]*(len(t)-len(s))
    s=s+lst
import sys
for i in range (len(s)):
    if min(s)<max(t):
        print ('Yes')
        sys.exit()
    elif min(s)>max(t):
        print ('No')
        sys.exit()
    else:
        if min(s)==max(t):
            s.remove(min(s))
            t.remove(max(t))
print ('No')

Submission status: Wrong Answer

Solution code:
s=list(str(input()))
t=list(str(input()))
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range (len(s)):
    for j in range (len(alphabet)):
        if s[i]==alphabet[j]:
            s[i]=j
for i in range (len(t)):
    for j in range (len(alphabet)):
        if t[i]==alphabet[j]:
            t[i]=j
if len(s)>len(t):
    lst=[-1]*(len(s)-len(t))
    t=t+lst

if len(t)>len(s):
    lst=[-1]*(len(t)-len(s))
    s=s+lst
import sys
for i in range (len(s)):
    if min(s)<max(t):
        print ('Yes')
        print(s)
        print(t)
        sys.exit()
    elif min(s)>max(t):
        print ('No')
        print(s)
        print(t)
        sys.exit()
    else:
        if min(s)==max(t):
            s.remove(min(s))
            t.remove(max(t))
print ('No')

Submission status: Wrong Answer

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

s.sort()
t.reverse()

if s<t :
    print('Yes')
elif s==t:
    print('No')
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:
a = list(input())
b = list(input())


a.sort()
b.reverse()
a = ''.join(a)
b = ''.join(b)
if a < b:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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


a.sort()
b.reverse()

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

Submission status: Wrong Answer

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

t = list(input())
t.sort(reverse=True)

j = 0
for i in s:
    if i < t[j]:
        print('Yes')
        break

    elif i > t[j]:
        print('No')
        break

    else:
        j += 1
        if j == len(t):
            print('No')
            break

Submission status: Wrong Answer

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

t = list(input())
t.sort(reverse=True)

j = 0
for i in s:
    if i < t[j]:
        print('Yes')
        break

    if i > t[j]:
        print('No')
        break

    if i == t[j]:
        j += 1
        if j == len(t):
            print('No')
            break

Submission status: Wrong Answer

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

t = list(input())
t.sort()
t.reverse()

j = 0
for i in s:
    if i < t[j]:
        print('Yes')
        break

    if i > t[j]:
        print('No')
        break

    if i == t[j]:
        j += 1
        if j == len(t):
            print('No')
            break

Submission status: Wrong Answer

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

t = list(input())
t.sort()

j = 0
for i in s:
    if i < t[j]:
        print('Yes')
        break

    if i > t[j]:
        print('No')
        break

    if i == t[j]:
        j += 1
        print(j)
        if j == len(t):
            print('No')
            break

Submission status: Wrong Answer

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

t = list(input())
t.sort()

j = 0
for i in s:
    if j > len(t):
        print('No')
        break

    if i < t[j]:
        print('Yes')
        break

    if i > t[j]:
        print('No')
        break

    if (i == t[j] and i == s[-1]):
        print('No')
        break

    if i == t[j]:
        j += 1

Submission status: Wrong Answer

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

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

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

    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    s.sort()
    t.reverse()

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

    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = sorted(input())
T = sorted(input(),reverse=True)
A = "No"
for sc,tc in zip(S,T):
    if sc == tc:
        continue
    elif sc < tc:
        A = "Yes"
        break
    else:
        break
if len(S) < len(T):
    A = "Yes"
print(A)

Submission status: Wrong Answer

Solution code:
S = sorted(input())
T = sorted(input(),reverse=True)
A = "Yes"
for sc,tc in zip(S,T):
    if sc == tc:
        continue
    elif sc < tc:
        break
    else:
        A = "No"
        break
if S==T:
    A = "No"
print(A)

Submission status: Wrong Answer

Solution code:
str_list1 = list(input())
str_list2 = list(input())
str_list2_inv = [i for i in sorted(str_list2)[::-1]]
str1 = ''.join(sorted(str_list1))
str2 = ''.join(str_list2_inv)
print(str1,str2)
if str1 == str2:
    print('No')
elif sorted([str1,str2])[0] == str1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from itertools import zip_longest

def twoAnagrams(s, t):
    s_str = ''.join(sorted(s))
    t_str = ''.join(sorted(t, reverse=True))

    if t_str.startswith(s_str):
        if len(s_str) < len(t_str):
            return True
        # this implies s and t is the same string
        else:
            return False

    for s_chr,t_chr in zip_longest(s_str, t_str):
        if s_chr is None:
            break
        elif t_chr is None or t_chr < s_chr:
            return False
    return True


s = list(input())
t = list(input())

print('Yes' if twoAnagrams(s,t) else '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.count(s[0]) < t.count(t[0]):
    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")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
l=max(len(s),len(t))
slist = []
tlist = []
for i in range(l):
    if i < len(s):
        slist.append(s[i])
    if i < len(t):
        tlist.append(t[i])
slist.sort()
tlist.sort(reverse=True)
result = 'Yes'
print(slist)
print(tlist)
if s==t:
    result = 'No'
else:
    for j in range(l):
        if j < len(s) and j < len(t):
            if slist[j] == tlist[j]:
                continue
            elif slist[j] < tlist[j]:
                break
            else:
                result = 'No'
                break
        elif len(s) > len(t):
            result = 'No'
            break
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if len(s) < len(t) and s < t:
	print("Yes")
elif len(s) < len(t) and t < s:
	print("No")
elif len(s) < len(t) and s == t:
	print("Yes")
elif len(t) < len(s) and s < t:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
s=sorted(list(s))
t=sorted(list(t))[::-1]
for i in range(len(s)-1):
    if ord(s[i])<ord(t[i]):
        print("Yes")
        sys.exit()
    else:
        print("No")
        sys.exit()
if len(s)<len(t):
    if ord(s[-1])<=ord(t[len(s)-1]):
        print("Yes")
        sys.exit()
else:
    if ord(s[len(t)-1])<ord(t[-1]):
        print("Yes")
        sys.exit()
print("No")

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
s=sorted(list(s))
t=sorted(list(t))[::-1]
for i in range(len(s)-1):
    if ord(s[i])<ord(t[i]):
        print("Yes")
        sys.exit()
    else:
        print("No")
        sys.exit()
if len(s)<len(t):
    if ord(s[-1])<=ord(t[len(s)-1]):
        print("Yes")
        sys.exit()
else:
    if ord(s[len(t)-1])<ord(t[-1]):
        print("Yes")
        sys.exit()
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)

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

Submission status: Wrong Answer

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

a.sort()
b.sort()

a = "".join(a)
b = "".join(b)

print("Yes" if a <= b else "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)

print("Yes" if a == b or list(sorted((a, b)))[0] == a else "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)

print("Yes" if list(sorted((a, b)))[0] == a else "No")

Submission status: Wrong Answer

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

a.sort()
b.sort()

a = "".join(a)
b = "".join(b)

print("Yes" if list(sorted((a, b)))[0] == a else "No")

Submission status: Wrong Answer

Solution code:
import sys

a=input()
b=input()
c=[]
d=[]
for i in range(len(a)):
    c.append(a[i])
for i in range(len(b)):
    d.append(b[i])
c.sort()
d.sort()
d.reverse()
print(c)
print(d)
for i in range(min([len(a),len(b)])):
    if(c[i]<d[i]):
        print("Yes")
        sys.exit()
if(len(a)<len(b)):
    if(a==b[0:len(a)]):
        print("Yes")
        sys.exit()
print("No")

Submission status: Wrong Answer

Solution code:
import sys

a=input()
b=input()
c=[]
d=[]
for i in range(len(a)):
    c.append(a[i])
for i in range(len(b)):
    d.append(b[i])
c.sort()
d.reverse()
for i in range(min([len(a),len(b)])):
    if(c[i]<d[i]):
        print("Yes")
        sys.exit()
if(len(a)<len(b)):
    if(a==b[0:len(a)]):
        print("Yes")
        sys.exit()
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:
def main():
    S = list(input())
    orig_S = S[:]
    T = sorted(list(input()), reverse=True)

    for t in T:
        target_s = None
        for s in S:
            if s < t:
                print("Yes")
                return
            elif s == t:
                target_s = s
            else:
                break

        if target_s is None:
            print("No")
            return
        else:
            S.remove(target_s)

        if len(S) == 0:
            break

    if len(orig_S) < len(T):
        print("Yes")
    else:
        print("No")

main()

Submission status: Wrong Answer

Solution code:
def main():
    S = sorted(list(input()))
    T = sorted(list(input()), reverse=True)

    for s,t in zip(S, T):
        if s > t:
            print("No")
            return
        elif s < t:
            print("Yes")
            return

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

main()

Submission status: Wrong Answer

Solution code:
s = [c for c in input()]
t = [c for c in input()]

s.sort()
t.sort()
t = t[::-1]

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

Submission status: Wrong Answer

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

import sys

s = raw_input().split()[0]
t = raw_input().split()[0]
#print s, t

sl = list(s)
sl.sort()
tl = list(t)
tl.sort(reverse=True)

print sl
print tl

if sl < tl:
    sys.stdout.write('Yes\n')
else:
    sys.stdout.write('No\n')
sys.stdout.flush()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc082/tasks/abc082_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(s, t):
    s.sort(reverse=True)
    t.sort(reverse=True)
    if t > s:
        return 'Yes'
    else:
        return 'No'


def main(args):
    s = list(input().strip())
    t = list(input().strip())
    ans = solve(s, t)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

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

for i in range(len(s)):
    if i < len(t):
        if ord(s[i]) < ord(t[i]):
            break
        elif ord(s[i]) > ord(t[i]):
            Flag = False
            break
        else:
            if i == len(s) - 1 and i == len(t) - 1:
                Flag = False
                break
    else:
        Flag = False
        break
            
    
if Flag == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input().strip())
s.sort()
t = list(input())
t.reverse()
a = [chr(i) for i in range(97, 97+26)]
cnt = 0
if len(s) > len(t):
  l = len(t)
else:
  l = len(s)
  
flg = 0
for i in range(l):
  if a.index(s[i]) < a.index(t[i]):
    print("Yes")
    flg += 1
    break
  elif a.index(s[i]) > a.index(t[i]):
    print("No")
    flg += 1
    break
  elif a.index(s[i]) == a.index(t[i]):
    cnt += 1
    
if cnt == len(s):
  if cnt < len(t):
    print("Yes")
  elif cnt >= len(t):
    print("No")

if flg == 0 and l < len(s):
  print("No")

Submission status: Wrong Answer

Solution code:
s = list(input().strip())
s.sort()
t = list(input())
t.reverse()
a = [chr(i) for i in range(97, 97+26)]
cnt = 0
if len(s) > len(t):
  l = len(t)
else:
  l = len(s)
  
for i in range(l):
  if a.index(s[i]) < a.index(t[i]):
    print("Yes")
    break
  elif a.index(s[i]) > a.index(t[i]):
    print("No")
    break
  elif a.index(s[i]) == a.index(t[i]):
    cnt += 1
    
if cnt == len(s):
  if cnt < len(t):
    print("Yes")
  elif cnt >= len(t):
    print("No")

if l < len(s):
  print("No")

Submission status: Wrong Answer

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

for i in range(len(s)):
    for j in range(len(t)):
        if ord(s[i]) < ord(t[j]):
            answer = True
            break
    if answer == True:
        break

if answer == True:
    print("Yes")
else:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

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

try:
    for i in s_sorted:
        for j in t_sorted:
            if i < j:
                print('Yes')
                raise Exception
            elif i == j:
                t_sorted.remove(i)
                break
        else:
            print('No')
            raise Exception
    if t_sorted != [] and s_sorted[0] < t_sorted[0]:
        print('Yes')
    else:
        print('No')
except Exception:
    pass

Submission status: Wrong Answer

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

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

try:
    for i in s_sorted:
        for j in t_sorted:
            if i < j:
                print('Yes')
                raise Exception
            elif i == j:
                t_sorted.remove(i)
                break
        else:
            print('No')
            raise Exception
    if t_sorted != []:
        print('Yes')
    else:
        print('No')
except Exception:
    pass

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
dic = {
        "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 = list(input())
t = list(input())
s.sort()
t.reverse()
if dic[s[0]] < dic[s[0]]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
l = list(str(raw_input()))
k = list(str(raw_input()))

l.sort()
k = sorted(k, reverse=True)

if l[0] == k[0]:
    print "Yes"
    exit()

if l[0] < k[0]:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
l = list(str(raw_input()))
k = list(str(raw_input()))

l.sort()
k = sorted(k, reverse=True)

if all(l) or all(k):
    print "Yes"
    exit()

if l[0] < k[0]:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
l = list(str(raw_input()))
k = list(str(raw_input()))

l.sort()
k = sorted(k, reverse=True)

if (len(l) == 1) or (len(k) == 1):
    print "Yes"
    exit()

if l[0] < k[0]:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
l = list(str(raw_input()))
k = list(str(raw_input()))

l.sort()
k = sorted(k, reverse=True)

if l[0] <= k[0]:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
l = list(str(raw_input()))
k = list(str(raw_input()))

l.sort()
k = sorted(k, reverse=True)

if l[0] < k[0]:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
S=input().strip()
T=input().strip()
s=[]
t=[]
for i in range(len(S)):
  s.append(str(S[i]))
for i in range(len(T)):
  t.append(str(T[i]))

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

print(s,t)

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

Submission status: Wrong Answer

Solution code:
S=input().split()
T=input().split()
s=[]
t=[]
for i in range(len(S)):
  s.append('S[i]')
for i in range(len(T)):
  t.append('T[i]')

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

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

Submission status: Wrong Answer

Solution code:
S=input().split()
T=input().split()
s=[]
t=[]
for i in range(len(S)):
  s.append('S[i]')
for i in range(len(T)):
  t.append('T[i]')

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

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