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(map(str,input()))))
t=''.join(sorted(list(map(str,input())),reverse=True))
print('YNeos'[s>=t::2])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    s = list(input().strip())
    t = list(input().strip())
    s.sort()
    t.sort(reverse=True)

    min_len = min(len(s), len(t))
    same = True
    for i in range(min_len):
        if s[i] < t[i]:
            print("Yes")
            return
        if s[i] != t[i]:
            same = False
    if same and len(s) < len(t):
        print("Yes")
    else:
        print("No")

main()

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:
alphabet = list("abcdefghijklmnopqrstuvwxyz")
s = list(input())
t = list(input())
lis = []
lit = []
c = 0
for i in s:
    lis.append(alphabet.index(i))
for i in t:
    lit.append(alphabet.index(i))
lis.sort()
lit.sort(reverse = True)
if len(lis) < len(lit):
    for i in range(len(s)):
        if lis[i] < lit[i]:
            print("Yes")
            c = 0
            break
        elif lis[i] == lit[i]:
            c = 1
            continue
        else:
            print("No")
            c = 0
            break
    if c == 1:
        print("Yes")
        
else:
    for i in range(len(lit)):
        if lis[i] < lit[i]:
            print("Yes")
            c = 0
            break
        elif lis[i] == lit[i]:
            c = 1
        else:
            print("No")
            c = 0
            break
    if c == 1:
        print("No")

Submission status: Accepted

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

len_s = len(s)
len_t = len(t)

end = False
for i in range(min(len_s, len_t)):
    if s[i] < t[i]:
        print("Yes")
        end = True
        break
    elif s[i] == t[i]:
        continue
    else:
        print("No")
        end = True
        break

if not end:
    if len_s < len_t:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
alp = "abcdefghijklmnopqrstuvwxyz"
def f(S):
    global alp
    A = []
    for s in S: A.append(alp.find(s))
    return A
S = f(input())
T = f(input())
S.sort()
T.sort(reverse=True)
flg = 0
for i in range(min(len(S),len(T))):
    if S[i]<T[i]:
        flg = 1
        break
    elif S[i]>T[i]:
        flg = -1
        break
if flg == 1: print("Yes")
elif flg == -1: print("No")
elif len(S)>=len(T): print("No")
else: print("Yes")

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    sl = sorted([ord(i) - 97 for i in input()])
    tl = sorted([ord(i) - 97 for i in input()], reverse=True)

    for s, t in zip(sl, tl):
        if s == t:
            continue
        elif s < t:
            print("Yes")
            exit()
        else:
            print("No")
            exit()

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

Submission status: Accepted

Solution code:
x = [i for i in input()]
y = [i for i in input()]

x.sort()
y.sort(reverse = True)

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

Submission status: Accepted

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

S = [i for i in s]
S.sort()
S_mn = "".join(S)

T = [j for j in t]
T.sort(reverse=True)
T_mx = "".join(T)

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

Submission status: Accepted

Solution code:
S = input()
T = input()
slist = []
for i in range(0, len(S)):
	slist.append(S[i])
slist.sort()
newS = ''
for i in range(0, len(slist)):
	newS = newS + slist[i]
tlist = []
for i in range(0, len(T)):
	tlist.append(T[i])
tlist.sort(reverse = True)
newT = ''
for i in range(0, len(tlist)):
	newT = newT + tlist[i]
if newS < newT:
	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)

s = ''.join(s)
t = ''.join(t)
check = [s, t]
check.sort()
if check[0] == s and check[0] != check[1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

if c<d:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
l_1 = sorted(list(str(input())))
l_2 = sorted(list(str(input())),reverse=True)
s_1 = "".join(l_1)
s_2 = "".join(l_2)
if s_1==s_2:
    print("No")
    exit()
l=sorted([s_1,s_2])
if l[0]==s_1:print("Yes")
else:print("No")

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 'No')

Submission status: Accepted

Solution code:
import sys
s=input()
t=input()
s_l=[]
t_l=[]

for i in range(len(s)):
    s_l.append(s[i])
    s_l.sort()
for i in range(len(t)):
    t_l.append(t[i])
    t_l.sort(reverse=True)


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

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:
def main():
    s, t = input(), (input())
    s, t = sorted(s), sorted(t, reverse=True)
    if s < t:
        print("Yes")
    if s >= t:
        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 = input()
t = input()
 
s_list = list(s)
t_list = list(t)
 
s_list.sort()
t_list.sort(reverse=True)
 
s = "".join(s_list)
t = "".join(t_list)
 
if s < t:
 	print("Yes")
else:
 	print("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)

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

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

Submission status: Accepted

Solution code:
lst_s = list(input())
lst_t = list(input())

lst_s.sort()
ss = ''.join(lst_s)

lst_t.sort()
lst_t.reverse()
tt = ''.join(lst_t)

if ss<tt:
    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:
row = [input().split() for i in range(2)]
s = list(row[0][0])
t = list(row[1][0])
s.sort()
t.sort(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("No")
elif sorted([s,t])[0] == s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

s_ac = ''.join(s)
t_ac = ''.join(t)

if s_ac < t_ac:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
flag = False
same = True
for i in range(min(len(s), len(t))):
    if(s[i] < t[i]):
        flag = True
        break
    elif(s[i] > t[i]):
        same = False

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

Submission status: Accepted

Solution code:
source_lst = list(map(lambda x:x,input()))
dest_lst = list(map(lambda x:x,input()))

source_lst.sort()
dest_lst.sort(reverse=True)

source = ''.join(source_lst)
dest = ''.join(dest_lst)

if source < dest :
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:

s = input()
t = input()

lis_s = list(s)
lis_t = list(t)

lis_s.sort()
lis_t.sort()

lis_t.reverse()

ns = ""
nt = ""

for i in lis_s:
    ns += i

for i in lis_t:
    nt += i

if ns < nt:
    print ("Yes")
else:
    print ("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
t=t[::-1]
flg=0
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        print("Yes")
        exit()
    if s[i]==t[i]:flg+=1
if flg==len(s) and len(s)!=len(t):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

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

if s1<t1:
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:
s1=input()
s2=input()
l1=[s1[i] for i in range(len(s1))]
l2=[s2[j] for j in range(len(s2))]
l1.sort()
l2.sort(reverse=True)
if l1==l2:
    print("No")
    exit()
l3=[l1,l2]
l4=sorted(l3)
if l3==l4:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# !/usr/bin python3
# -*- coding: UTF-8 -*-

s = input()
t = input()

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

# sorted()で辞書順に並べ替える。リスト型の結果が返るため、
# join()メソッドでつなぐ
 
if s_asc < t_desc:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

S = s()
T = s()

Sd = ''.join(sorted(S))
Td = ''.join(sorted(T, reverse=True))

if Sd < Td:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#文字列を並び替えて辞書順になるかどうか
s = list(input())
s.sort()
t = list(input())
t.sort()
t = t[::-1]
        
for i in range(min(len(s), len(t))):
    if s[i] == t[i]:
        pass
    elif s[i] < t[i]:
        print("Yes")
        break
    elif s[i] > t[i]:
        print("No")
        break
else:
    if len(s) == len(t):
        print("No")
    elif len(s) < len(t):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

s_char = []
t_char = []
for s_c in s:
    s_char.append(ord(s_c))
for t_c in t:
    t_char.append(ord(t_c))

s_char.sort()
t_char.sort(reverse=True)

s_len = len(s_char)
t_len = len(t_char)
min_len = min(s_len, t_len)
for i in range(min_len):
    if s_char[i] == t_char[i]:
        continue
    if s_char[i] < t_char[i]:
        print('Yes')
        exit()
    else:
        print('No')
        exit()
if s_len < t_len:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict
import math


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def mod_inv(x):
    # available only when mod is prime
    global mod
    return pow(x, mod - 2, mod)


def gcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    ret = math.factorial(x)
    ret = ret // (math.factorial(x - y) * math.factorial(y))

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)


###############################################################################


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

    slist = [c for c in s]
    tlist = [c for c in t]

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

        if not tlist:
            print("No")
            return
        if not slist and tlist:
            print("Yes")
            return
        if slist[0] < tlist[0]:
            print("Yes")
            return
        if slist[0] > tlist[0]:
            print("No")
            return

        del slist[0]
        del tlist[0]


if __name__ == '__main__':
    main()

Submission status: Accepted

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

flag = 0

for i in range(max(len(s), len(t))):
    if len(t) - 1  < i and flag == 1:
        print("No")
        exit()
    elif len(s) - 1 < i and flag == 1:
        print("Yes")
        exit()
        
    if s[i] < t[i]:
        print("Yes")
        exit()
    elif s[i] == t[i]:
        flag = 1
        continue
    else:
        print("No")
        exit()

print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
s1 = [str(a) for a in s]
t1 = [str(a) for a in t]
s1.sort()
t1.sort()
import copy
t2 = copy.copy(t1)
for i in range(len(t1)):
  t1[i] = t2[len(t1)-i-1]

n = 0
l = 0
i = 0
while n==0 and i <= min(len(t),len(s))-1:
  if s1[i] == t1[i]:
    l = l + 1
    i = i + 1
  elif s1[i] < t1[i]:
    n = n + 1
    print('Yes')
  elif s1[i] > t1[i]:
    n = n + 1
    print('No')
if l == len(t) and len(t) <= len(s):
  print('No')
elif l == len(s) and len(s) < len(t):
  print('Yes')

Submission status: Accepted

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

s.sort()
t.sort()
t.reverse()
print(("No","Yes")["".join(s)<"".join(t)])

Submission status: Accepted

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

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(s: str, t: str):
    s2 = list(s)
    s2.sort()
    s2 = "".join(s2)

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

    if s2 < t2:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = [s for s in input()]
t = [t for t in input()]
s.sort()
s = ''.join(s)
t.sort(reverse=True)
t = ''.join(t)
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=1))

#sの方を小さくできるかどうか
if s < t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
# from pprint import pprint


s1 = sys.stdin.readline().rstrip()
s2 = sys.stdin.readline().rstrip()

s1x = ''.join(sorted(list(s1)))
s2x = ''.join(sorted(list(s2), reverse=True))

if s1x < s2x:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def abc():
    s = list(input().rstrip())
    t = list(input().rstrip())

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


abc()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

if s == t:
    ans = "No"
else:
    s = "".join(sorted(s))
    t = "".join(sorted(t)[::-1])
    if sorted([s,t])[0] == s:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
ss=''
tt=''
for i in range(len(s)):
    ss+=s[i]   
    
for i in range(len(t)):
    tt+=t[len(t)-1-i]
if ss<tt:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")


S, T = [sys.stdin.readline().rstrip() for _ in range(2)]
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 = "".join(sorted(list(input())))
t = "".join(sorted(list(input()),reverse = True))
if s < t:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
a = sorted(input())
b = reversed(sorted(input()))
c = ''.join(a) 
d = ''.join(b)

if c < d :
	print("Yes")
elif c >= d:
	print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
schar=[]
tchar=[]
for i in range(len(s)):
  schar.append(ord(s[i]))
for i in range(len(t)):
  tchar.append(ord(t[i]))
schar.sort()
tchar.sort(reverse=True)
flag=0
for i in range(min(len(s),len(t))):
  if schar[i]==tchar[i]:
    continue
  elif schar[i]>tchar[i]:
    flag=1
    break
  else:
    flag=-1
    break
if flag==1:
  print("No")
elif flag==-1:
  print("Yes")
else:
  if len(s)<len(t):  
    print("Yes")
  else:
    print("No")

Submission status: Accepted

Solution code:
s = list(str(input()))
t = list(str(input()))
s.sort()
t.sort(reverse = True)
s2 = ''.join(s)
t2 = ''.join(t)
if s2 < t2 :
    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 = list(input())
t = list(input()[::])


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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
s = sorted(input())
t = sorted(input(),reverse=True)
N = min(len(s),len(t))

for i in range(N):
    if s[i] > t[i]:
        print('No')
        sys.exit()
    elif s[i] < t[i]:
        print('Yes')
        sys.exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

s = input()
t = input()

s1 = list(s)
t1 = list(t)

s1.sort()
t1.sort(reverse=True)

# print(s1,t1)

ans = 0

for i in range(min(len(s), len(t))):
    if s1[i] < t1[i]:
        ans += 1
if len(s) < len(t) and s1[:len(s)] == t1[:len(s)]:
    ans += 100000000

print('Yes' if ans >= 1 else 'No')

Submission status: Accepted

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

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

S = len(s)
T = len(t)
# print ('a' < 'b')

# print (s, t)

for i in range(min(S,T)):
    if s[i] < t[i]:
        print ('Yes')
        sys.exit()
    if s[i] > t[i]:
        print ('No')
        sys.exit()
    if i == min(S,T) - 1 and T <= S:
        print ('No')
        sys.exit()

print ('Yes')

Submission status: Accepted

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


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

Submission status: Accepted

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

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

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

if s < 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)
ALP = "abcdefghijklmnopqrstuvwxyz"

for s, t in zip(S, T):
    if s == t:
        continue
    elif ALP.index(s) < ALP.index(t):
        print("Yes")
        break
    else:
        print("No")
        break
else:
    if len(S) < len(T):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

s_sorted = ''.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:
from collections import defaultdict

def main():
    a = list(input())
    a.sort()
    a = ''.join(a)
    b = list(input())
    b.sort(reverse=True)
    b = ''.join(b)
    ans = [a, b]
    ans .sort()
    # print(a, b)
    if ans[0] == b:
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

s_ = list(s)
t_ = list(t)
s__ = s_.sort()
t__ = t_.sort(reverse = True)

sdash = ''.join(s_)
tdash = ''.join(t_)

if sdash < tdash:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
slist = []
for i in range(0, len(s)):
	slist.append(s[i])
tlist = []
for i in range(0, len(t)):
	tlist.append(t[i])
slist.sort()
tlist.sort(reverse = True)
news = ''
for i in range(0, len(slist)):
	news = news + slist[i]
newt = ''
for i in range(0, len(tlist)):
	newt = newt + tlist[i]
if news < newt: 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 i in range(len(t)):
  T.append(t[i])
s_sort=''
t_sort=''
for i in range(len(S)):
  s_sort=s_sort+sorted(S)[i]
for i in range(len(T)):
  t_sort=t_sort+sorted(T)[::-1][i]
print('Yes' if s_sort<t_sort else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [input() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    s = list(ST())
    t = list(ST())
    s.sort()
    t.sort(reverse=True)
    if s == t:
        print("No")
    else:
        if sorted([s, t])[0] == s:
            print("Yes")
        else:
            print("No")
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s1 = input()
s2 = input()
ls1 = list(s1)
ls2 = list(s2)
ls1.sort()
ls2.sort(reverse=True)
if ls1 < ls2:
  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")