Problem:


Score : 200 points

Problem Statement

You are given strings s and t, consisting of lowercase English letters.
You will create a string s' by freely rearranging the characters in s.
You will also create a string t' by freely rearranging the characters in t.
Determine whether it is possible to satisfy s' < t' for the lexicographic order.

Notes

For a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M, we say a < b for the lexicographic order if either one of the following two conditions holds true:

N < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.

There exists i (1 \leq i \leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.

For example, xy < xya and atcoder < atlas.

Constraints

The lengths of s and t are between 1 and 100 (inclusive).

s and t consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

s
t

Output

If it is possible to satisfy s' < t', print Yes; if it is not, print No.

Sample Input 1

yx
axy

Sample Output 1

Yes

We can, for example, rearrange yx into xy and axy into yxa. Then, xy < yxa.

Sample Input 2

ratcode
atlas

Sample Output 2

Yes

We can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort < tslaa.

Sample Input 3

cd
abc

Sample Output 3

No

No matter how we rearrange cd and abc, we cannot achieve our objective.

Sample Input 4

w
ww

Sample Output 4

Yes

Sample Input 5

zzz
zzz

Sample Output 5

No



Sample input:
yx
axy


Sample output:
Yes

Submission status: Accepted

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

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

ans = 'Yes' if s < t else 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s_list = [c for c in s]
t_list = [c for c in t]

s_list.sort()
t_list.sort()

sd = "".join(s_list)
td = "".join(t_list[::-1])

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

Submission status: Accepted

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

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

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

exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
if s==t:
    print('No')
    exit(0)
alp="abcdefghijklmnopqrstuvwxyz"
d={}
e={}
for i in range(len(alp)):
    d[alp[i]]=i
    e[i]=alp[i]

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

s_array=sorted(s_array)

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

t_array=sorted(t_array,reverse=True)

s=''
for i in range(len(s_array)):
    s+=e[s_array[i]]

t=''
for j in range(len(t_array)):
    t+=e[t_array[j]]

dictionary={}
dictionary[s]=1
dictionary[t]=1

dictionary=sorted(dictionary.items(),key=lambda x: x[0])

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

Submission status: Accepted

Solution code:

if __name__ == '__main__':
    a = input()
    b = input()
    asort=''.join(sorted(a))
    bsort=''.join(sorted(b,reverse=True))

    if asort <bsort:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
s = sorted(list(input()))
t = sorted(list(input()))[::-1]
            
for S, T in zip(s, t):
    if S < T:
        print('Yes')
        exit()
    elif S > T:
        print('No')
        exit()
    else:
        continue

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
def main():
    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')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [p for p in input()]
t = [p for p in input()]
s.sort()
t.sort()
t.reverse()
print('Yes' if s < t else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s0 = input()
t0 = input()
list_s0 = list(s0)
list_t0 = list(t0)
list_s0.sort()
list_t0.sort(reverse = True)
s1 = "".join(list_s0)
t1 = "".join(list_t0)
if s1 < t1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s = list(input())
t = list(input())
s.sort()
t.sort()
for x, y in zip(s, t[::-1]):
    if x > y:
        print('No')
        sys.exit()
    elif x == y:
        continue
    else:
        print('Yes')
        sys.exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s, t = [input() for _ in range(2)]
print("Yes" if "".join(sorted(s)) < "".join(sorted(t, reverse=True)) else "No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC082-B
s = list(input())
t = list(input())

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
a=[s,t]
a.sort()
if s==t:
  print("No")
else:
  if a[0]==s:
    print("Yes")
  else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lst = []
s = sorted(list(input()))
lst.append(s)
t = sorted(list(input()),reverse=True)
lst.append(t)
lst.sort()
if lst[0] == lst[1]:
  answer = "No"
elif lst[0] == s:
  answer = "Yes"
else:
  answer = "No"
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

a = input()
b = input()

aa = list(a)
bb = list(b)

aa.sort()
bb.sort(reverse=True)


S = "".join(aa)
T = "".join(bb)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
aa = input()
bb = input()

a = list(aa)
b = list(bb)

a.sort()
b.sort()

b = b[::-1]

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


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

Submission status: Accepted

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

sl = list(s)
sl.sort()
tl = list(t)
tl.sort()
tl=tl[::-1]
S="".join(sl)
T="".join(tl)
if S<T:
    ans ='Yes'
else:
    ans = 'No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
l_s = [s[i] for i in range(len(s))]
l_t = [t[i] for i in range(len(t))]
l_s.sort()
l_t.sort(reverse=True)
s_new = ''.join(l_s)
t_new = ''.join(l_t)
if s_new < t_new:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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


def read():
    S = input().strip()
    T = input().strip()
    return S, T


def solve(S, T):
    s = ''.join(sorted(S))
    t = ''.join(reversed(sorted(T)))
    return "Yes" if s < t else "No"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Submission status: Accepted

Solution code:
s = input()
t = input()
ss = sorted(s)
tt = sorted(t)[::-1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

sl = len(ss)
tl = len(tt)

ttr = list(reversed(tt))

if sl >= tl:
    for i in range(tl):
        if ss[i] < ttr[i]:
            print("Yes")
            exit()
        elif ss[i] > ttr[i]:
            print("No")
            exit()
    print("No")
    exit()
    
elif sl < tl:
    for i in range(sl):
        if ss[i] < ttr[i]:
            print("Yes")
            exit()
        elif ss[i] > ttr [i]:
            print("No")
            exit()
    print("Yes")
    exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
if s==t and s.count(s[0])==len(s) and t.count(s[0])==len(t):
    print('No')
elif s.count(s[0])==len(s) and t.count(s[0])==len(t):
    if len(s)<len(t):
      print('Yes')
    else:
      print('No')
else:
    if ord(s[0])==ord(t[-1]):
      print('No')
    elif ord(s[0])<ord(t[-1]):
      print('Yes')
    else:
      print('No')

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
l=min(len(s), len(t))
for i in range(l):
  if s[i]==t[i]:
    continue
    
  if s[i]<t[i]:
    print("Yes")
    exit()
  else:
    print("No")
    exit()
if len(s)>=len(t):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    s = input().rstrip()
    t = input().rstrip()

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

    ans = "Yes" if ss < tt else "No"
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import collections

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

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

Submission status: Accepted

Solution code:
#TwoAnagrams
s = input()
t = input()
S = sorted(s)
T = sorted(t, reverse = True)
ST = sorted([S, T])
if ST[0] != T:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
s_ = sorted(s)
t_ = sorted(t, reverse=True)
for n, i in enumerate(zip(s_, t_)):
    if i [0]< i[1]:
        print('Yes')
        break
    elif i[1] < i[0]:
        print('No')
        break
    if n + 1 == min(len(s_), len(t_)):
        if len(s_) < len(t_):
            print('Yes')
            break
        elif len(t_) <= len(s_):
            print('No')
            break

Submission status: Accepted

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

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


if sDash < tDash:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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


def checkAlphabetOrder(a, b):
    temp = [a, b]
    compare = sorted(temp)
    return temp[0] == compare[0]


# main
for i in range(min(len(s), len(t))):
    if sDash[i] == tDash[i]: continue
    elif checkAlphabetOrder(sDash[i], tDash[i]):
        print('Yes')
        break
    else:
        print('No')
        break
else:
  if len(s) < len(t):
    print('Yes')
  else:
    print('No')

Submission status: Accepted

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

S = sorted(s); T = sorted(t, reverse = True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
frag=""
n=min(len(s),len(t))
for i in range(n):
  if min(s)<max(t):
    frag="Yes"
    break
  elif min(s)>max(t):
    frag="No"
    break
  else:
    s.pop(s.index(min(s)))
    t.pop(t.index(max(t)))
if frag=="":
  if len(t)>0:
    frag="Yes"
  else:
    frag='No'
print(frag)

Submission status: Accepted

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

s1=[s[i] for i in range(len(s))]
t1=[t[i] for i in range(len(t))]
s1.sort()
t1.sort(reverse=True)
S="".join(s1)
T="".join(t1)
#print(S,T)
l=[S,T]
l.sort()
if l[0]==S:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

l = [s,t]
l.sort()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print('YNeos'[S>=T::2])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = sorted(list(str(input())))
T = sorted(list(str(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]:
        if i+1 == len(S) < len(T):
            print('Yes')
            break
        elif i+1 == len(T):
            print('No')
            break
        else:
            continue
    else:
        print('No')
        break

Submission status: Accepted

Solution code:
import sys
s = str(input())
t = str(input())
sl = list(s)
tl = list(t)
sl.sort()
tl.sort()
tl = tl[::-1]
a = "".join(sl)
b = "".join(tl)
if a == b:
    print("No")
    sys.exit()
ls = [a,b]
new = sorted(ls)
if ls[0] == new[0]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

s1 = ''
t1 = ''

for i in s:
    s1 += i

for i in t:
    t1 += i

if s1 < t1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if len(s) < len(t):
  len = len(s)
  flg_s=1
else:
  len = len(t)
  flg_s=0
for i in range(len):
  if ord(s[i]) < ord(t[i]):
    print('Yes')
    exit(0)
  elif ord(s[i]) > ord(t[i]):
    print('No')
    exit(0)
if flg_s == 1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
strs="".join(s)
strt="".join(t)
list1=[strs,strt]
str1=list1[0]
list1.sort()
if s==t:
    print("No")
elif str1==list1[0]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = sorted(input())
t = sorted(input(),reverse=True)
flag = -1
i = 0



while(i < min(len(s),len(t))):
  if s[i] > t[i]:
    flag = -1
    break
  elif s[i] < t[i]:
    flag = 1
    break
  else:
    if (i+1 == len(s)) & (len(s) != len(t)):
      flag = 1
      break
    i += 1

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)



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

Submission status: Accepted

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

Submission status: Accepted

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

s.sort()
t.sort(reverse = True)
s1 = ''.join(s)
t1 = ''.join(t)

if s1 < t1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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


for i in range(101):
  if min(s) > max(t):
    print('No')
    exit()
    
  elif min(s) == max(t):
    s.remove(min(s))
    t.remove(max(t))
    if s == [] and t != []:
      print('Yes')
      exit()
    elif s == [] and t == []:
      print('No')
      exit()
    elif s != [] and t == []:
      print('No')
      exit()
  if min(s) < max(t):
    print('Yes')
    exit()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if s1 < t1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

flag = 0
for elem1, elem2 in zip(s, t):
  if ord(elem1) < ord(elem2):
    print('Yes')
    quit()
  elif ord(elem1) == ord(elem2):
    pass
  else:
    flag = 1
    break
if flag == 1:
  print('No')
else:
  if len(s) < len(t):
    print('Yes')
  else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
ls = sorted(list(s))
lt = sorted(list(t),reverse=True)
os = [ord(x) for x in ls]
ot = [ord(x) for x in lt]
for i in range(min(len(s),len(t))):
	if os[i] < ot[i]:
		print('Yes')
		break
	elif os[i] > ot[i]:
		print('No')
		break
else:
	if len(s) < len(t):
		print('Yes')
	else:
		print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
u=''.join(s)
v=''.join(t)

if u<v:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

s = input()
t = input()

if s < t:
	print("Yes")
	exit()
tmp = sorted(s)[0] #sの最小の文字

for x in t: #tにおける全ての文字がsの最小文字より大きいか。
	if tmp < x:
		print("Yes")
		break
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

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

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
S.sort()
T.sort(reverse=True)
A = "abcdefghijklmnopqrstuvwxyz"

for a, b in zip(S, T):
    if A.index(a) < A.index(b):
        print("Yes")
        exit()
    elif A.index(b) < A.index(a):
        print("No")
        exit() 

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    t = input()
    s = ''.join(sorted(list(s)))
    t = ''.join(sorted(list(t), reverse=True))
    print('Yes') if s < t else print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
t = input()
sd = sorted(list(s))
td = sorted(list(t))[::-1]
ss = ''.join(sd)
tt = ''.join(td)
print('Yes' if ss<tt else 'No')

Submission status: Accepted

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

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

d = [s1, t1]
d = sorted(d)
if s1 == t1:
    print("No")
elif d[0] == s1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
S = "".join(s)
T = "".join(t)
st = [S, T]
st.sort()

if S == T:
    print("No")
elif st[0] == S:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s = [i for i in input()]
s.sort()
t = [i for i in input()]
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')