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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s = input()
new_s = "".join(sorted(s))

t = input()
new_t = "".join(sorted(t, reverse = True))

if new_s < new_t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
""" AtCoder """

s = input()
t = input()

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
for i,j in zip(s,t):
  if i > j:
    print("No")
    exit()
  elif i < j:
    print("Yes")
    exit()
len_s = len(s)
len_t = len(t)
if len(s) >= len(t):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
#x,y= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意

x = input()
y = input()
a = []
b = []
for i in range(len(x)):
    a.append(x[i])
for i in range(len(y)):
    b.append(y[i])
a.sort()
b.sort(reverse=True)
j(''.join(a) < ''.join(b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str_s = input()
str_t = input()

str_s_d = sorted(str_s)
str_t_d = sorted(str_t, reverse=True)

if str_s_d < str_t_d:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
slist = []
tlist = []
for i in s:
    slist.append(ord(i))
for i in t:
    tlist.append(ord(i))

slist.sort()
tlist.sort(reverse=True)

while True:
    if not slist and not tlist:
        print('No')
        exit(0)
    elif not tlist:
        print('No')
        exit(0)
    elif not slist:
        print('Yes')
        exit(0)

    spop = slist.pop(0)
    tpop = tlist.pop(0)

    if spop == tpop:
        pass
    elif spop > tpop:
        print('No')
        exit(0)
    else:
        print('Yes')
        exit(0)

Submission status: Accepted

Solution code:
# import collections
s = [i for i in input()]
s.sort()
s ="".join(s)
t = [i for i in input()]
t.sort(reverse = True)
t ="".join(t)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
ok=False
snum=[]
tnum=[]
for i in range(len(s)):
    snum.append(ord(s[i]))
snum.sort()
for i in range(len(t)):
    tnum.append(ord(t[i]))
tnum.sort(reverse=True)
if len(s)>=len(t):
    round=len(t)
else:
    round=len(s)
for i in range(round):
    if (snum[i]<tnum[i]) or (snum==tnum[:round]and len(t)>len(s)):
        ok=True
        break
print("Yes"if ok else"No")

Submission status: Accepted

Solution code:
s=sorted(list(input()))
t=sorted(list(input()))[::-1]
for i in range(min(len(s),len(t))):
  if(s[i]<t[i]):
    print('Yes')
    exit()
  elif(s[i]>t[i]):
    print('No')
    exit()
if(len(s)<len(t)):print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
s=sorted(list(input()))
t=sorted(list(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(i<min(len(s)-1,len(t)-1)):pass
    else:#sの長さまでは同じ。sの方が短ければYes、そうでなければNo
      if(len(s)<len(t)):
        print('Yes')
        break
      else:
        print('No')
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
sl = [s[i] for i in range(len(s))]
tl = [t[i] for i in range(len(t))]
n = len(sl)
m = len(tl)
sl.sort()
tl.sort(reverse=True)
s_ans = ''.join(sl)
t_ans = ''.join(tl)
if s_ans < t_ans:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s, t = input(), input()
n = max(len(s), len(t))
a = sorted(map(ord, s))+[0]*(n-len(s))
b = sorted(map(ord, t), reverse=True)+[0]*(n-len(t))
for k, l in zip(a, b):
    if k < l:
        print("Yes")
        break
    if k > l:
        print("No")
        break
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print("Yes" if sorted([c for c in input()])<sorted([c for c in input()],reverse=1) else "No")

Submission status: Accepted

Solution code:
a,b=input(), input()
aa=[A for A in a]
aa.sort()
bb=[B for B in b]
bb.sort(reverse=1)
print("No" if aa>=bb else "Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = sorted(list(input()))
T = sorted(list(input()))[::-1]
if S == T:
    print("No")
    exit()
s = ""
t = ""
for x in S:
    s += x
for x in T:
    t += x
compare_place = sorted([s,t])
if compare_place[0] == s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 082
def db(x): 
    global debug
    if debug: print(x)
debug = False
s = input()
sl = [c for c in s]
t = input()
tl = [c for c in t]
sl.sort()
tl.sort()
tl.reverse()
db((sl,tl))
for i in range(min(len(s),len(t))):
    if sl[i]<tl[i]:
        print('Yes')
        break
    elif  sl[i]>tl[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=sorted(s)
t=sorted(t,reverse=True)
print('Yes' if s<t else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from sys import stdin
 
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
s = sorted(s)
t = sorted(t,reverse =True)
tmp1 =("".join(s))
tmp2 =("".join(t))
if tmp1 < tmp2 :print('Yes')
else:print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s = ''.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 = list(input())
t = list(input())

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
subset = True
ans = ""
for i in range(min(len(s),len(t))):
    s_n = s.pop(s.index(min(s)))
    t_n = t.pop(t.index(max(t)))
    if s_n != t_n:
        subset = False
        if s_n < t_n:
            ans = "Yes"
        else:
            ans = "No"
        break
if subset == True:
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ss = input()
ts = input()

print('Yes' if sorted(ss) < sorted(ts, reverse=True) else 'No')

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))

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

for i in range(min(len(S), len(T))):
    if S[i] < T[i]:
        print("Yes")
        exit()
    elif S[i] == T[i]:
        continue
    else:
        print("No")
        exit()
if len(S) >= len(T):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

SS = [s for s in S]
TT = [t for t in T]
SS.sort()
TT.sort(reverse=True)
S = "".join(SS)
T = "".join(TT)

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

Submission status: Accepted

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

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

if s_new < t_new:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
n=list(input())
n.sort()
p=list(input())
p.sort()
p=p[::-1]
d=[n,p]
d.sort()
print("Yes"if d[0]!=p else"No")

Submission status: Accepted

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

a = [a for a in input()]
b = [a for a in input()]

l = ["".join(sorted(a)), "".join(sorted(b, reverse=True))]

if l[0] == l[1]:
    print("No")
elif l == sorted(l):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=[i for i in input()]
b=[i for i in input()]
a=sorted(a)
b=sorted(b)
b=b[::-1]

#print(a)
#print(b)

hantei=True
if len(a)<len(b):
	for i in range(len(a)):
		if a[i]>b[i]:
			hantei=False
			break
		elif a[i]<b[i]:
			hantei=True
			break
else:
	hantei=False
	for i in range(len(b)):
		if a[i]>b[i]:
			hantei=False
			break
		elif a[i]<b[i]:
			hantei=True
			break
if hantei == True:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
# Two Anagrams
import sys

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

# 昇順
s.sort()
# 降順
t.sort(reverse=True)

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

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
A = []
B = []
for i in s:
    A.append(ord(i))
for j in t:
    B.append(ord(j))
count=0
if(min(A)<max(B)):
    print("Yes")
    count+=1
else:
    for i in range(min(len(A), len(B))):
        if(min(A)> max(B)):
            print("No")
            count+=1
            break
if(len(set(A)) == len(set(B)) and len(A)<len(B) and count==0):
    print("Yes")
    count+=1
if(count==0):
    print("No")

Submission status: Accepted

Solution code:
s = str(sorted(list(input()))).replace(']', '').replace('[', '').replace(',', '')
t = str(sorted(list(input()), reverse=True)).replace(']', '').replace('[', '').replace(',', '')

if str(s)<str(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:
print("Yes" if ''.join(sorted(input())) < ''.join(reversed(sorted(list(input())))) else "No")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
s = input()[:-1]
t = input()[:-1]
print("Yes" if sorted(s) < sorted(t)[::-1] else "No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
S = ''
T = ''
s.sort()
t.sort(reverse = True)
for c in s:
    S += c
for c in t:
    T += c
if S < T:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
#ls=len(s)
t=input()
#lt=len(t)
#print(s,t)
s=[ord(i) for i in s]
s.sort()
#print(s)
t=[ord(i) for i in t]
t.sort()
#print(t)

flag=0
for i in range(len(s)):
  for j in range(len(t)):
    if s[i] < t[j]:
      flag=1
    elif len(s) < len(t) and s==t[:len(s)]:
      flag=1
      
print('Yes' if flag==1 else 'No')

Submission status: Accepted

Solution code:
import sys

lines = sys.stdin.readlines()
s = [ord(c) - 96 for c in lines[0].strip()]
t = [ord(c) - 96 for c in lines[1].strip()]

def check(s, t):
  if not len(s) and len(t):
    print('Yes')
    return
  elif not len(t) and len(s):
    print('No')
    return
  elif not len(s) and not len(t):
    print('No')
    return
    
  if min(s) < max(t):
    print('Yes')
  elif min(s) > max(t):
    print('No')
  else:
    s.remove(min(s))
    t.remove(max(t))
    return check(s, t)

check(s, t)

Submission status: Accepted

Solution code:
S = str(input())
T = str(input())
S = sorted(S)
T = sorted(T,reverse = True)
list = [S,T]
list = sorted(list)
if list[0] == list[1]:
    print("No")
elif list[0] == S:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
print("YNeos"[s>=t::2])

Submission status: Accepted

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

Submission status: Accepted

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

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

    s_bytes = sorted(s.encode())
    t_bytes = sorted(t.encode(), reverse = True)

    s_len = len(s)
    t_len = len(t)

    gt = s_len < t_len

    for i in range(len(s_bytes)):
        if t_len <= i:
            gt = False
            break
        if s_bytes[i] == t_bytes[i]:
            continue
        gt = s_bytes[i] < t_bytes[i]
        break

    print('Yes' if gt else 'No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

    for i in range(min(len(s), len(t))):
        if ord(s[i]) < ord(t[i]):
            print("Yes")
            return 0

    if len(s) < len(t):
        for c in s:
            if c in t:
                t.remove(c)
            else:
                print("No")
                return 0
        print("Yes")
        return 0

    print("No")


abc082_b()

Submission status: Accepted

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

if s_list < t_list:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = ''.join(sorted(s))
t = ''.join(sorted(t)[::-1])

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input()
    t = input()

    s_1 = "".join(sorted(s))
    t_1 = "".join(reversed(sorted(t)))

    if s_1 < t_1:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
s = list(raw_input())
t = list(raw_input())
s1 = sorted(s)
t1 = sorted(t,reverse=True)
if s1<t1:
  print 'Yes'
else:
  print 'No'

Submission status: Accepted

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

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

if(s_as<t_as):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest114-B
#  https://beta.atcoder.jp/contests/abc082/tasks/abc082_b


def compalTwoString(orgs,orgt):

	minStringS = ''.join(sorted(orgs,reverse=False))
	maxStringT = ''.join(sorted(orgt,reverse=True))
	if minStringS < maxStringT :
		answer= "Yes"
	else:
		answer= "No"
	return answer


if __name__ == '__main__':
	stringS=input()
	stringT=input()
	check=compalTwoString(stringS,stringT)
	print(check)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = input()
Y = input()
X = [c for c in X]
Y = [c for c in Y]
X.sort()
Y.sort()
Y.reverse()
if ''.join(X) < ''.join(Y):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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


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

Submission status: Accepted

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

if __name__ == "__main__":
    s = list(str(input()))
    t = list(str(input()))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = sorted(input())
b = sorted(input(),reverse=True)
ar = ["".join(a),"".join(b)]
br = sorted(ar)
if a == b:
    print("No")
else:
    if ar == br:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def str_sort(x, s = False):
    y = sorted(x, reverse = s)
    return ''.join(y)

s = input()
t = input()

s = str_sort(s)
t = str_sort(t, True)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sList = ["" for i in range(len(s))]
tList = ["" for i in range(len(t))]
for i in range(len(s)):
    sList[i] = (ord(s[i])-ord("a"))
for i in range(len(t)):
    tList[i] = (ord(t[i])-ord("a"))
sList = sorted(sList)
tList = sorted(tList)[::-1]

for i in range(min(len(sList), len(tList))):
    if sList[i] < tList[i]:
        print("Yes")
        exit()
    elif sList[i] > tList[i]:
        print("No")
        exit()
if len(sList) < len(tList):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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
    if i == min(len(s), len(t)) - 1:
        if len(s) == len(t):
            print('No')
        elif min(len(s), len(t)) == len(s):
            print('Yes')
        else:
            print('No')

Submission status: Accepted

Solution code:
def sorted_str(s):
    return "".join(sorted([c for c in s]))

s = input()
t = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
def judge(l1,l2): # l1 (= l2
    for e in l1:
        if e not in l2:
            return False
            break
        elif e  == l1[-1]:
            return True
if len(s) < len(t) and judge(s,t):
    print("Yes")
else:
    s_ord = [ord(e) for e in s]
    t_ord = [ord(e) for e in t]
    s_ord.sort()
    t_ord.sort()
    t_ord.reverse()
    for i in range(min(len(t_ord),len(s_ord))):
        if t_ord[i] > s_ord[i]:
            print("Yes")
            break
        elif i == min(len(t_ord),len(s_ord)) - 1:
            print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s, t = [list(input()) for i in range(2)]
s2 = ''
t2 = ''
for i in sorted(s):
  s2 += i
for i in sorted(t, reverse=True):
  t2 += i
print('Yes') if s2<t2 else print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
N = list(input())
M = list(input())

N.sort()
M.sort(reverse = True)

if(len(N) < len(M)):
    for i in range(len(N)):
        if(M[i] > N[i]):
            print("Yes")
            sys.exit()
        elif(M[i] == N[i]):
            continue
        else:
            print("No")
            sys.exit()
    print("Yes")

if(len(N) >= len(M)):
    for i in range(len(M)):
        if(M[i] > N[i]):
            print("Yes")
            sys.exit()
        elif(M[i] == N[i]):
            continue
        else:
            print("No")
            sys.exit()
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
if s==t:
    print("No")
    quit()
s.sort()
t.sort()
t = t[::-1]
v = [s,t]
u = [s,t]
u.sort()
if u == v:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

#文字列読み込み
s = input()
t = input()

#それぞれの文字列を分解してソートし再結合
s_list = sorted(list(s))
t_list = sorted(list(t), reverse=True)

s_ana = ''.join(s_list)
t_ana = ''.join(t_list)

#比較
result = "Yes" if (s_ana < t_ana) else "No"

#出力
print(result)

Submission status: Accepted

Solution code:
import string


S = list(input())
T = list(input())

L = list(string.ascii_lowercase)

S = [L.index(s) for s in S]
T = [L.index(t) for t in T]

S.sort()
T.sort()
T.reverse()

while True:
    if len(S) == 0:
        if len(T) > 0:
            print('Yes')
            break
        else:
            print('No')
            break
    if len(T) == 0:
        print('No')
        break
    s = S[0]
    t = T[0]
    if s < t:
        print('Yes')
        break
    elif s == t:
        del S[0]
        del T[0]
    else:
        print('No')
        break

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
ans = [s, t]
ans.sort()
if s == t:
    print("No")
elif ans[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:
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 = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
print("YNeos"[s >= t::2])

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:
from sys import stdin


def main() -> None:
    s, t = [next_str() for _ in range(2)]
    print("Yes" if sorted(s) < (sorted(t, reverse=True)) else "No")


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s=input()
t=input()
res='No'

sl = list(s)
tl = list(t)

sl.sort()
tl.sort(reverse=True)

if sl < tl:
  res='Yes'
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 'No'
n_con = min(len(s), len(t))
for i in range(n_con):
	if s[i] != t[i]:
		com_list = [s[i], t[i]]
		com_list.sort()
		if com_list[0] == s[i]:
			ans = 'Yes'
			break
if s[:n_con] == t[:n_con] and len(s) < len(t):
	ans = 'Yes'
print(ans)

Submission status: Accepted

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