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


if  s != t and s == sorted([s,t])[0]:
 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))

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

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

Submission status: Accepted

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

s = sorted(s)
t = sorted(t, reverse=True)
sl = "".join(s)
tl = "".join(t)

if sl < tl:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = sorted(s)
t = sorted(t, reverse=True)
sl = "".join(s)
tl = "".join(t)

if sl < tl:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s=sorted(s)
t=sorted(t)[::-1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
t.sort(reverse=True)
s.sort()
if s < t:
    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=input()
t=input()
s=sorted(list(s))
t=sorted(list(t), reverse=True)
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 = input().rstrip()
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())

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

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

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
n=len(s)
m=len(t)
s.sort()
t.sort(reverse=True)
ans='No'
for i in range(min(n,m)):
    if s[i]<t[i]:
        ans='Yes'
    elif s[min(n,m)-1]==t[min(n,m)-1] and n<m:
        ans='Yes'
print(ans)

Submission status: Accepted

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

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

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)

s = list(map(lambda x : ord(x), s))
t = list(map(lambda x : ord(x), t))

i = 0
while i < min(len(s), len(t)):
    if s[i] < t[i]:
        print('Yes')
        break
    elif s[i] == t[i]:
        i += 1
    else:
        print('No')
        break
if i == min(len(s), len(t)):
    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.reverse()
 
if s < t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
hoge=list(input())
huga=list(input())
hoge.sort()
huga.sort(reverse=True)
flag=0

for i in range(min(len(hoge),len(huga))):
  if(hoge[i]>huga[i]):
    flag=1
    break
  elif(hoge[i]<huga[i]):
    flag=-1
    break

if(flag==0):
  if(len(hoge)>=len(huga)):
    flag=1
    
    
if(flag==1):
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

size = min(len(s), len(t))
result = ""

for i in range(size):
    if s[i] < t[i]:
        result = "Yes"
        break

if result == "":
    if s[0:size] == t[0:size]:
        if len(s) < len(t):
            result = "Yes"
        else:
            result = "No"
    else:
        result = "No"

print(result)

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("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if s == t:
	print("No")
	exit()



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

sss = "".join(ss)
ttt = "".join(tt)


A = [sss, ttt]
A.sort()

if A[0] == sss:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t)
t.reverse()
t = "".join(t)
s = "".join(s)
if (s < t):
    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:
sl = list(input())
tl = list(input())

print('Yes') if ''.join(sorted(sl)) < ''.join(sorted(tl, reverse=True)) else print('No')

Submission status: Accepted

Solution code:
from sys import stdin
s = list(stdin.readline().rstrip())
t = list(stdin.readline().rstrip())
s.sort()
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#82
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())
 
s_ = list(s)
t_ = list(t)
 
s_.sort()
t_.sort(reverse = True)
 
s_sorted = ""
for S in s_:
  s_sorted += S
 
t_sorted =""
for T in t_:
  t_sorted += T
 
if s_sorted < t_sorted:
  print('Yes')
  
else:
  print('No')

Submission status: Accepted

Solution code:
def solve(string):
    s, t = string.split()
    return "Yes" if sorted(s) < sorted(t,reverse=True) else "No"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Accepted

Solution code:
def dic(s):
  dics,ans=[],""
  for i in range(len(s)):dics.append(s[i])
  dics.sort()
  for i in dics:ans+=i
  return ans
print("Yes"if dic(input())<dic(input())[::-1]else"No")

Submission status: Accepted

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

print("Yes" if s < t else "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())
s.sort()

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

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

Submission status: Accepted

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

s = list(input())
t = list(input())
s1 = sorted(s)
t1 = sorted(t, reverse=True)
print('Yes' if s1 < t1 else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
y = sorted(input())
x1 = ''.join(sorted(x))
y1 = ''.join(list(reversed(y)))
if x1 < y1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = [i for i in S()]
t = [i for i in S()]
f = 0
if len(s)<len(t):
    f = len(s)
s.sort()
t.sort(reverse=True)
for a,b in zip(s,t):
    if a < b:
        print("Yes")
        exit()
    elif a == b:
        f -= 1
if f == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(input())
b = list(input())
for i in range(len(a)-1):
    for j in range(len(a)-i-1):
        if a[j] >= a[j+1]:
            a[j],a[j+1] = a[j+1],a[j]
for i in range(len(b)-1):
    for j in range(len(b)-i-1):
        if b[j] >= b[j+1]:
            b[j],b[j+1] = b[j+1],b[j]
a_string = ''.join(a)
b_string = ''.join(b[::-1])
if a_string < b_string:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

def histgram(s):
    h = {}
    for i in range(26):
        ch = chr(i + ord('a'))
        h[ch] = 0
    for ch in s:
        h[ch] += 1
    return h
h_s = histgram(s)
h_t = histgram(t)
s_ = ""
for i in range(26):
    ch = chr(i + ord('a'))
    for j in range(h_s[ch]):
        s_ += ch
t_ = ""
for i in range(25, -1, -1):
    ch = chr(i + ord('a'))
    for j in range(h_t[ch]):
        t_ += ch
ans = s_ < t_

print("Yes" if ans else "No")

Submission status: Accepted

Solution code:
from sys import exit
import math
# N = int(input())
# a = [int(input()) for _ in range(N)]
S = list(input())
T = list(input())
S = "".join(sorted(S))
T = "".join(sorted(T)[::-1])
print("Yes" if S<T else "No")
# L = len(S)
# T = str(input())

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,t=[str(input()) for i in range(2)]
print('Yes') if ''.join(sorted(list(s))) < ''.join(sorted(list(t)))[::-1] else print('No')

Submission status: Accepted

Solution code:
x=list(input())
y=list(input())
x.sort();y.sort(reverse=True)
''.join(x);''.join(y)

if x<y:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s=input()
t=input()
ss=[]
st=[]
for i in (s):
    ss.append(i)
for i in (t):
    st.append(i)
ss.sort()
st.sort(reverse=True)
ans='No'
#print(''.join(ss),''.join(st))
if ''.join(ss)<''.join(st):
    ans='Yes'

print(ans)

Submission status: Accepted

Solution code:
s=sorted;print('YNeos'[s(input())>=s(input())[::-1]::2])

Submission status: Accepted

Solution code:
S = sorted(input())
N = sorted(input())
N.reverse()
print("Yes" if S < N  else "No")

Submission status: Accepted

Solution code:
s = input()
s_asc = ''.join(sorted(s))

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

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

Submission status: Accepted

Solution code:
s = input()
        
s_asc = ''.join(sorted(s))

t = input()

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc082/tasks/abc082_b

import itertools
import collections
import bisect

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



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def two_anagrams(s: str, t: str) -> bool:
    '''s を並び替えた実現可能な最小の文字列 s' と t を並び替えて
    実現可能な最小の文字列 t' に関して、s' < t' が成り立てば良い。
    '''
    sn, tn = len(s), len(t)
    sd, td = sorted(s), sorted(t, reverse=True)

    idx = 0
    while idx < sn and idx < tn:
        # idx-1 番目の文字までは同じと仮定する。
        if sd[idx] < td[idx]:
            # この場合 sn < tn が成り立つ。
            return True
        if sd[idx] == td[idx]:
            # 次に持ち越し
            idx += 1
            continue
        if sd[idx] > td[idx]:
            # この場合 sn > tn が成り立つ。
            return False

    # min(sn, tn) 番目まで同じ。あとは長いほうが後ろ
    return sn < tn


if __name__ == "__main__":
    s = input()
    t = input()
    yes = two_anagrams(s, t)
    print('Yes' if yes else '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:
n = list(input())
m = list(input())
n.sort()
m.sort(reverse = True)
n = "".join(n)
m = "".join(m)
if m > n:
    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:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007
 
#A
"""
a, b = LI()
print((a+b+1)//2)
"""
 
#B
a = S()
a = a[:-1]
b = S()
b = b[:-1]
a.sort()
b.sort(reverse=True)
if a < b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007

#A
"""
a, b = LI()
print((a+b+1)//2)
"""

#B
a = S()
a = a[:-1]
b = S()
b = b[:-1]
a.sort()
b.sort(reverse=True)
if a < b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math

def A():
    a, b = [int(x) for x in input().split()]
    print(math.ceil((a + b)/2))

def B():
    a = ''.join(sorted(list(input()), key=lambda x:ord(x)))
    b = ''.join(sorted(list(input()), key=lambda x:-ord(x)))
    if a < b:
        print('Yes')
    else:
        print('No')

B()

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:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    a,b = LI()
    print(math.ceil((a+b)/2))

#B
def B():
    s = S()
    t = S()
    s.sort()
    t.sort()
    t = t[::-1]
    l = [s,t]
    l.sort()
    if s == t:
        print("No")
    elif l[0] == s:
        print("Yes")
    else:
        print("No")
#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    s = [str(c) for c in input().strip()]
    t = [str(c) for c in input().strip()]

    s = sorted(s)
    t = sorted(t)[::-1]

    S = ''
    for c in s:
        S += c
    T = ''
    for c in t:
        T += c

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

s_ = sorted(s)
t_ = sorted(t)[::-1]

s_ = "".join(s_)
t_ = "".join(t_)

if s_ < t_:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#B
import collections

s = str(input())
t = str(input())
sd = list(s)
td = list(t)
sd.sort()
td.sort(reverse=True)
a = ''
b = ''
for c in sd:
    a += c
for c in td:
    b += c
if sd < td:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

if sorted(a) < sorted(b, reverse=True):
    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))
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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:
s1 = input()
t1 = input()

s2 = sorted(s1)
t2 = sorted(t1,reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
alphabet = list('@abcdefghijklmnopqrstuvwxyz')
#@ :空白を表す
judge = -1 #0:可,-1:不可

if(len(s)>len(t)):
 for i in range(len(s)-len(t)):
   t.append('@')
elif(len(s)<len(t)):
 for i in range(len(t)-len(s)):
   s.append('@')

len0 = len(s)
count = 0
while(len(s) > 0):
  a = alphabet.index(s[0])
  b = alphabet.index(t[0])
  if(a < b):
    judge = 0 #可:0
    break
  elif(a == b):
    count += 1
  else:
    judeg = -1
    break #不可:-1
  s.pop(0)
  t.pop(0)
  
if((judge == -1)or(count == len0)):
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
print("Yes" if s<t[::-1] 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 = []
T = []
for i in s:
    S.append(i)
S.sort()
for i in t:
    T.append(i)
    T.sort(reverse = True)

Sstring = "".join(S)
Tstring = "".join(T)
print("Yes" if Sstring < Tstring else "No")

Submission status: Accepted

Solution code:
# coding: utf-8
A = sorted(list(map(ord, list(input()))))
B = sorted(list(map(ord, list(input()))), reverse=True)
ans = 'No'
for i in range(min(len(A), len(B))):
    if A[i] < B[i]:
        ans = 'Yes'
        break
    elif A[i] > B[i]:
        break
    if i == len(A) - 1 and len(A) != len(B):
        ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
flag=0
for i in s:
    for j in t:
        if i<j:
            flag=1
            break
            
if flag :
    print("Yes")
elif s.count(s[0])==len(s) and t.count(s[0])==len(t) and len(s)<len(t):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=sorted([i for i in input()])
t=list(reversed(sorted([i for i in input()])))
str_s=""
str_t=""
for i in s:
    str_s+=i
for i in t:
    str_t+=i
print("Yes" if str_s<str_t else "No")

Submission status: Accepted

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

A=[x,y]

A.sort()

if A[0]==x and x!=y:
    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(reverse = True)
if len(s) < len(t):
    if s <= t[:len(s)]:
        print("Yes")
    else:
        print("No")
else:
    if s < t:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

if s[0] < t[len(t)-1]:
    print('Yes')
elif s[0] > t[len(t)-1]:
    print('No')
elif len(s) < len(t):
    for i in range(len(s)):
        if s[i] != t[i]:
            print('No')
            break
        elif i == len(s)-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:
s = input()
t = input()
no = 0

A = "abcdefghijklmnopqrstuvwxyz"
B = {}
for i in range(26) :
    B[A[i]] = i

S = []
for i in range(len(s)) :
    S.append(B[s[i]])
T = []
for i in range(len(t)) :
    T.append(B[t[i]])
S.sort()
T.sort(reverse=1)
#print(S)
#print(T)
i = 0
while i < len(s) and i < len(t) and S[i] == T[i] :
    i += 1
#print(i)
if i == len(t) and len(s) >= len(t) :
    no = 1
elif i <= len(s)-1 and  S[i] > T[i] :
    no = 1
if no == 1 :
    print("No")
else :
    print("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 = ''.join(sorted(input()))
t = ''.join(sorted(input(), reverse=True))
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s,t = map(str, [input() for i in range(2)])

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


def XY(x, y):
    x.sort()
    y.sort(reverse=True)
    c = 0
    D = True
    while c < len(x) and c < len(y):
        if x[c] < y[c]:
            break
        elif x[c] == y[c]:
            c += 1
        elif x[c] > y[c]:
            D = False
            break
        if len(x) >= len(y) and c == len(y)-1 and x[c] >= y[c]:
            D = False


    return D

Result = XY(S, T)

if Result:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
s_asc = ''.join(sorted(s))

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

if(s_asc < t_des):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 00:39:05 2019

@author: yuta
"""

def dic(n,m):
    x = ''.join(sorted(n))
    y = ''.join(sorted(m,reverse = True))
    if x < y:
        print("Yes")
    else:
        print("No")
dic(input(),input())

Submission status: Accepted

Solution code:
s=input()
t=input()
ss=''.join(sorted(s))
tt=''.join(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)
s2=""
t2=""
for x in s:
    s2+=x
for y in t:
    t2+=y
if s2==t2:
    print("No")
    exit()
c=sorted([s2,t2])
if c[0]==s2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#s=input()
#t=input()
#answer_copipe
s=input()
s_asc=''.join(sorted(s))
#print(s_asc)

t=input()
t_desc=''.join(sorted(t,reverse=True))
tal=''.join(sorted(t))
#print(t_desc)
#print(tal)

if(s_asc<t_desc):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#answer_copipe
s=input()
s_asc=''.join(sorted(s))

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

if(s_asc<t_desc):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s_ = ''
t_ = ''

for i in s:
    s_ += i
for i in t:
    t_ += i

if s_ < t_:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
new_s = sorted(s)
new_t = sorted(t, reverse = True)
if new_s < new_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:
# encoding:utf-8

import copy
import numpy as np
import random

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

s.sort()
t.sort(reverse=True)
# print(s,t)

ans = False
min_str = min(len(s),len(t))
for i in range(min_str):
    if s[i]==t[i]:
        if min_str-1 == i and len(t)>len(s):
            ans = True
    elif s[i]>t[i]:
        ans = False
        break
    else:
        ans = True
        break

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

Submission status: Accepted

Solution code:
import sys


def main(s, t):
    s_ = ''
    for i in sorted(s):
        s_ += i

    t_ = ''
    for i in sorted(t, reverse=True):
        t_ += i

    if s_ < t_:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    _s = input()
    _t = input()
    ret = main(_s, _t)
    print(ret)

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()
t=input()

sl = [s[i] for i in range(0,len(s))]
tl = [t[i] for i in range(0,len(t))]
slsort = sorted(sl)
tlreversesort = sorted(tl, reverse=True)

# print(slsort)
# print(tlreversesort)

if slsort < tlreversesort:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input();t=input()
s=sorted(s)
t=sorted(t)
tnew=[]

for i in range(len(t)-1,-1,-1):
    #print(i)
    tnew.append(t[i])
cnt=0

if len(s)<=len(t):
    L=len(s)
else:
    L=len(t)


for i in range(L):
    if s[i]<tnew[i]:
        print('Yes')
        cnt=1
        break
    if s[i]>tnew[i]:
        print('No')
        cnt=1
        break

if cnt==0:
    if len(tnew)>len(s):
        print('Yes')
    else:
        print('No')