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

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

if sort_s < sort_t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

t.sort()
t.reverse()
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(reverse=True)

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

Submission status: Accepted

Solution code:
F=sorted;print('NYoe s'[F(input())<F(input())[::-1]::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def log(v):
    print(v, file=sys.stderr)


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

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

Submission status: Accepted

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

sorted_s = "".join(sorted(s))
rev_sorted_t = "".join(sorted(t)[::-1])

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

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()

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

if s_dash < t_dash:
    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 "No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = sorted(input())
b = sorted(input(), reverse=True)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def check():
    S = [s for s in input()]
    T = [t for t in input()]
    S.sort()
    S = ''.join(S)
    T.sort(reverse=True)
    T = ''.join(T)
    if S<T:
        return True
    return False
if check():
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
s2=sorted(list(s))
t2=sorted(list(t))
s2_mojiretu="".join(sorted(s2))
t2_mojiretu="".join(reversed(t2))
if s2_mojiretu<t2_mojiretu:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(map(lambda x: ord(x),list(input())))
t = list(map(lambda x: ord(x),list(input())))
s.sort()
t.sort(reverse=True)
p = len(s)
q = len(t)

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

if p >= q:
    print("No")
    exit()

print("Yes")

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 = sorted(input())
t = sorted(input())
if s < t[::-1]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

S = list(sorted(s))+['a']
T = list(sorted(t))[::-1]+['a']

ans = 'No'
for i in range(min(len(S),len(T))):
    if S[i] < T[i]:
        ans = 'Yes'
        break
    
print(ans)

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:
icase=0
if icase==0:
    s=list(input())
    t=list(input())
    s.sort()
    t.sort(reverse=True)
    si="".join(s)
    ti="".join(t)
    if si<ti:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
## coding: UTF-8

s = input()
t = input()


ls = []
lt = []
for i in range(len(s)):
    ls.append(s[i])
for j in range(len(t)):
    lt.append(t[j])

ls.sort()
lt.sort(reverse = True)
#print('ls:{}, lt:{}'.format(ls, lt))
s_min = (''.join(ls))
t_max = (''.join(lt))
#print('s_min:{}, t_max:{}'.format(s_min, t_max))

#print(s_min < t_max)
if(s_min < t_max):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# solution
import io

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

Submission status: Accepted

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for i in range(len(s)):
    if i>len(t)-1:
        print('No')
        break
    elif s[i]>t[i]:
        print('No')
        break
    elif s[i]<t[i]:
        print('Yes')
        break
else:
    if len(t)==len(s):
        print('No')
    else:
        print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(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 = list(input())
t = list(input())
s.sort()
t.sort()
s = "".join(s)
t = "".join(t)[::-1]
minLength = min(len(s), len(t))
for i in range(minLength):
  if ord(s[i]) > ord(t[i]):
    print("No")
    exit()
  elif ord(s[i]) < ord(t[i]):
    print("Yes")
    exit()
if minLength == len(s) and len(t) > minLength:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-TwoAnagrams.py
#
s = input()
t = input()

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

for i in range(min(len(s), len(t))):
    if s_sorted[i] == t_sorted[i]:
        continue
    elif ord(s_sorted[i]) < ord(t_sorted[i]):
        print("Yes")
        exit()
    else:
        print("No")
        exit()

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

Submission status: Accepted

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

S.sort()
T.sort(reverse=True)
S = ''.join(S)
T = ''.join(T)
order = sorted([S, T])
if order[0] == S and S != T:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

#print(s, t)

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

for i in range(length):
    if s[i] < t[i]:
        print('Yes')
        sys.exit()
    elif s[i] == t[i]:
        continue
    else:
        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.sort()
t.sort(reverse=True)
s = "".join(s)
t = "".join(t)
if s == t:
    print("No")
    exit()
ans = [s,t]
ans2 = sorted(ans)
if ans == ans2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def resolve():
    s=list(input())
    t=list(input())
    s.sort()
    t.sort()
    t.reverse()
    if s>=t:
        print("No")
    else:
        print("Yes")
resolve()

Submission status: Accepted

Solution code:
s = ''.join(sorted(input(), reverse=False))
t = ''.join(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()))[::-1]
print('Yes' if S<T else 'No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = input()
a_asc = ''.join(sorted(a))

b = input()
b_desc = ''.join(sorted(b, reverse=True))

if a_asc < b_desc:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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


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

new_s = ''.join(s)
new_t = ''.join(t)

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
if len(s) < len(t):
    
    k = True
    for i in range(len(s)):
        if s[i] !=t[i]:k = False


s.sort()
t.sort(reverse = True)
ok = "".join(s) < "".join(t)
if len(s) < len(t):ok |=k
if ok:print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
# ABC 082: B – Two Anagrams
s, t = [list(input()) for _ in range(2)]
s.sort()
t.sort()
t.reverse()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
S = []
T = []
for i in range(len(s)):
    S.append(s[i])
for j in range(len(t)):
    T.append(t[j])
S.sort()
T.sort()
T.reverse()
a = ''
b = ''
for i in range(len(s)):
    a += S[i]
for j in range(len(t)):
    b += T[j]
if a < b:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = sorted(list(str(input())))
t = reversed(sorted(list(str(input()))))
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')

Submission status: Accepted

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


if s<t:
    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:
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 = list((sorted(input())))
t = list(reversed(sorted(input())))
if s < t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

s=input()
t=input()
s1,t1="",""

for i in range(len(s)):
  if i!=0:
    if s1[0]>=s[i]:
      s1=s[i]+s1
    
    else:
      s1+=s[i]
      
  else:
    s1=s[i]
    
for i in range(len(t)):
  if i!=0:
    if t1[0]<=t[i]:
      t1=t[i]+t1
    
    else:
      t1+=t[i]
      
    if t1>s1:
      print("Yes")
      sys.exit()
      
  else:
    t1=t[i]
    
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 = sorted(input())
t = sorted(input(),reverse=True)
ss=''
tt=''
for i in s:
    ss += i
for i in t:
    tt += i

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
sl = list()
for S in s:
    sl.append(S)
tl = list()
for T in t:
    tl.append(T)
sl.sort()
tl.sort()
tl.reverse()
l = [''.join(sl), ''.join(tl)]
l.sort()
if l[0]!=l[1]:
    print('Yes' if ''.join(sl) == l[0] else 'No')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, m = [sorted(list(input())) for i in range(2)]
print("Yes" if n < m[::-1] else "No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s = [ord(i) for i in s]
t = [ord(i) for i in t]
s_new = sorted(s)
t_new = sorted(t,reverse=True)
flag = False
for i in range(len(s)):
    if len(t) == i:
        break
        
        
    if s_new[i] < t_new[i]:
        flag = True
        break
        
    elif s_new[i] > t_new[i]:
        break
        
    if i == len(s)-1:
        if i < len(t)-1:
            flag = True
        
print('Yes' if flag ==True else 'No')

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)
alphabets = [chr(i) for i in range(97, 97+26)]  # 大文字
numbers = [i for i in range(1, 27)]
dict1 = dict(zip(alphabets, numbers))
frag = False
for i in range(min(len(s_list),len(t_list))):
  if dict1[s_list[i]] < dict1[t_list[i]]:
    frag = True
    break
  elif dict1[s_list[i]] > dict1[t_list[i]]:
    break
  elif dict1[s_list[i]] == dict1[t_list[i]]:
    if i == min(len(s_list),len(t_list)) - 1 and len(s_list) < len(t_list):
      frag = True
      break
    else:
      continue
if frag:
  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)

[print('Yes') if s < t 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 = input()
t = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()
b.sort(reverse=True)
f = [int(len(b)), int(len(a))]
e = min(f)
for i in range(int(e)):
    c =[a[i],b[i]]
    d = sorted(c)
    if i != int(e)-1:
        if a[i] == b[i]:
            continue
        elif c != d:
            print("No")
            break
        else:
            print("Yes")
            break
    if i == int(e)-1:
        if a[i] == b[i]:
            if int(len(a)) >= int(len(b)):
                print("No")
            else:
                print("Yes")
        elif c != d:
            print("No")
            break
        else:
            print("Yes")
            break

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort() # list.sort()で昇順にソート
t.sort()
t.reverse() # ソートした文字列を逆順に並び替え
s = ''.join(s)
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(reverse=True)
ss = ''.join(s)
tt = ''.join(t)

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

Submission status: Accepted

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

#辞書順
s = sorted(s)
t = sorted(t)

#逆順処理
t = t[::-1]

#文字数記憶
sf = len(s)
tf = len(t)

#判定
flag = 0

i = 0

while sf>0 and tf>0:
    if s[i] < t[i]:
        print('Yes')
        flag += 1
        break
    elif s[i] > t[i]:
        print('No')
        flag += 1
        break
    elif s[i] == t[i]:
        sf -= 1
        tf -= 1
        i += 1

if flag == 0:
    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()
t=t[::-1]
s="".join(s)
t="".join(t)

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

Submission status: Accepted

Solution code:
s=sorted;i=input;print("NYoe s"[s(i())<s(i())[::-1]::2])

Submission status: Accepted

Solution code:
s = sorted
i = input
print(["No", "Yes"][s(i()) < s(i(), reverse=True)])

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:
# coding: utf-8
# Your code here!

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

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

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

if ans[0]==t:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
sa = "".join(s)
ta = "".join(t)

ans = "No"
l = [sa, ta]
l.sort()
if l[1] == ta:
    ans = "Yes"
if l[0] == l[1]:
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
a = sorted(input())
b = sorted(input(),reverse=True)

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

flag = al < bl

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

Submission status: Accepted

Solution code:
a = str(input())
b = str(input())
a = sorted(a)
b  =sorted(b,reverse=True)
if a < b:
    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:
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 = sorted(input())
t = sorted(input(), reverse=True)
N = len(s)
M = len(t)

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

Submission status: Accepted

Solution code:
url = "https://atcoder.jp/contests/abc082/tasks/abc082_b"


def main():
    s1, s2 = [input() for i in range(2)]
    l1 = sorted(list(s1))
    l2 = sorted(list(s2), reverse=True)
    indx = 0
    if len(l1) > len(l2):
        indx = len(l2)
    else:
        indx = len(l1)
    for i in range(indx):
        if l1[i] < l2[i]:
            print('Yes')
            exit()
    if len(l1) < len(l2) and l1[-1] <= l2[-1]:
        print('Yes')
        exit()
    print('No')




if __name__ == '__main__':
    main()

Submission status: Accepted

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

S = ''
T = ''

temps = sorted(s)
tempt = sorted(t, reverse=True)
for i in range(len(s)):
    S += temps[i]
for i in range(len(t)):
    T += tempt[i]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ss = list(input())
tt = list(input())

ss.sort()
tt.sort(reverse = True)
s1 = ''
t1 = ''
ans = []
for i in ss:
    s1 += i
ans.append(s1)     
for i in tt:
    t1 += i 
ans.append(t1)
ans.sort()
num = ans.index(t1)
if num == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = list(iss())
    B = list(iss())
    A.sort()
    B.sort(reverse=True)
    print('Yes' if ''.join(A) < ''.join(B) else 'No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
s.sort()
t = list(input())
t.sort()
t.reverse()
print('Yes' if s < t else '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)
s1=''.join(s)
t1=''.join(t)
k=[s1,t1]
k.sort()
if s1==t1:print('No')
elif k[0]==s1:print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
# Written by NoKnowledgeGG @YlePhan
 
#import math
#mod = 10**9+7
 
 
 
def main():
  s = input()
  t = input()
  
  s = sorted(list(s))
  t = sorted(list(t),reverse=True)
  #print(s,t)
  if s < t:
    print('Yes')
  else:
    print('No')
  
  
if __name__ == '__main__':
  main()

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

#print(s, t)
kaburi=min(len(s), len(t))
for i in range(kaburi):
    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:
import sys

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

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

if st == tt:
    print("No")
    sys.exit()

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

Submission status: Accepted

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

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

s = ''.join(list_s)
t = ''.join(list_t)

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:
x=list(str(input()))
y=list(str(input()))
x.sort()
y.sort(reverse=True)

while len(x)!=len(y):
	if len(x)>len(y):
		y.append('Z')
	else:
		x.append('Z')
ans=0
i=0

while  ans==0 and i!=len(x):
	if ord(x[i])>ord(y[i]):
		ans=-1
	elif ord(x[i])<ord(y[i]):
		ans=1
	else:
		i=i+1
if ans==1:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
base=["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"]
s=input()
t=input()

S=[]
T=[]


answer="NO"

for i in s:
    S.append(base.index(i))
for j in t:
    T.append(base.index(j))
S=sorted(S)
T=sorted(T,reverse=True)
#print(S)
#print(T)

for k in range(min(len(S),len(T))):
    if S[k]>T[k]:
        answer="No"
        break
    elif S[k]<T[k]:
        answer="Yes"
        break
if answer=="NO" and len(S)<len(T):
    answer="Yes"
elif answer=="NO" and len(S)>=len(T):
    answer="No"

print(answer)

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)

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

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

s = [ S[i] for i in range(len(S))]
t = [ T[i] for i in range(len(T))]

s.sort()
t.sort()
t.reverse()

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

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    t = input()
    sl = [c for c in s]
    tl = [c for c in t]
    sl.sort()
    tl.sort(reverse=True)
    s2 = "".join(sl)
    t2 = "".join(tl)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s,t=[sorted(input())for i in(0,0)];print("YNeos"[s>=t[::-1]::2])

Submission status: Accepted

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

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

Submission status: Accepted

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

s.sort()
t.sort(reverse=True)
ss = ''.join(s)
ts = ''.join(t)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def resolve():
    s=list(input())
    t=list(input())
    ss=sorted(s)
    tt=sorted(t,reverse=True)
    if ss<tt:
        print('Yes')
    else:
        print('No')


resolve()

Submission status: Accepted

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