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

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

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

S = str()
T = str()

for x in s:
	S += x

for y in t:
	T += y

if sorted([S, T])[0] == S and S != T:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
a = sorted(input())
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
if aa < bb:
  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 = [i for i in input()]
t = [i for i in input()]

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

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

Submission status: Accepted

Solution code:
s = input()
t = input()
output = "No"
s_sort = sorted(s)
t_sort = sorted(t)
t_sort.reverse()
s_str = "".join(s_sort)
t_str = "".join(t_sort)
if s_str < t_str:
    output = "Yes"

print(output)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = input()
m = input()

n = sorted(n)
m = sorted(m, reverse = True)

flag = True

if len(n) < len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = True
elif len(n) == len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
else:
    for i in range(len(m)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
        

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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()
list.sort(t,reverse=True)
q = []
q.append(s)
q.append(t)
q.sort()
if s == t:
  print("No")
elif s == q[0]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
sl = []
tl = []
for c in s:
    sl.append(c)
for c in t:
    tl.append(c)
sl.sort()
tl.sort(reverse=True)
s = "".join(sl)
t = "".join(tl)
print("Yes" if s < t else "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 = list(input().strip())
s1 = sorted(s)
t = list(input().strip())
t1 = sorted(t,reverse=True)
if s1<t1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

s = list(input()[:-1])
t = list(input()[:-1])
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())
s_num = len(s)
t = list(input())
t_num = len(t)
s.sort()
t.sort(reverse=True)
nagasa = min(s_num, t_num)
hantei = False
onaji = True
for i in range(nagasa):
    S = ord(s[i])
    T = ord(t[i])
    if S < T:
        hantei = True
        break
    if S != T:
        onaji = False
if onaji and nagasa < t_num:
    hantei = True
print("Yes" if hantei else "No")

Submission status: Accepted

Solution code:
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

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

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

N = len(S)
M = len(T)

n = min(N, M)
for i in range(n):
    if ord(S[i]) < ord(T[i]):
        print ('Yes')
        exit()
    elif ord(S[i]) > ord(T[i]):
        print ('No')
        exit()

if N < M:
    print ('Yes')
else:
    print ('No')

Submission status: Accepted

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

S = [0]*26
T = [0]*26
for i in range(len(s)):
    c = ord(s[i])-ord('a')
    S[c] += 1

for i in range(len(t)):
    c = ord(t[i])-ord('a')
    T[c] += 1

s_ = ''
for i in range(26):
    s_ += chr(i+ord('a'))*S[i]

t_ = ''
for i in reversed(range(26)):
    t_ += chr(i+ord('a'))*T[i]

X = [s_, t_]
#print(X)
if s_ == t_:
    print('No')
    exit()
Y = sorted(X)
if X[0] == Y[0]:
    print('Yes')
else:
    print('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 = "".join(sorted(list(input())))
t = "".join(sorted(list(input()), reverse = True))
print('Yes' if s < t else 'No')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=list(input())
    t=list(input())
    s.sort()
    t.sort(reverse=True)
    if s<t:
        print('Yes')

    else:
        print('No')
resolve()

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
t = t[::-1]

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

Submission status: Accepted

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

S = [ord(s) for s in S]
T = [ord(s) for s in T]

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

LS = len(S)
LT = len(T)

ok = None
for i in range(min(LS,LT)):
  s = S[i]
  t = T[i]
  if s < t:
    ok = True
    break
  elif s == t:
    continue
  elif t < s:
    ok = False
    break

if ok:
  print('Yes')
elif ok == None:
  if LS < LT:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Accepted

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

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

s_str = ''.join(s)
t_str = ''.join(t)

if s_str < t_str:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

a = sorted(a)
b = sorted(b,reverse=True)

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

Submission status: Accepted

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

a = sorted(a)
b = sorted(b,reverse=True)

N = len(a)
M = len(b)

can = False
i = 0

while i < N and i < M:
    if can == True:
      break

    if a[i] < b[i]:
        can = True
    elif a[i] > b[i]:
        break
    elif i==N - 1 and N < M:
        can = True
    i+=1

if can == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

if s_check < t_check:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: <encoding name> -*-

s = input()
t = input()

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

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

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

if sss < ttt:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
s = sys.stdin.readline().rstrip("\n")
t = sys.stdin.readline().rstrip("\n")
s_ = sorted(s)
s_ = ''.join(s_)
t_ = sorted(t, reverse=True)
t_ = ''.join(t_)
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("No")
  exit()

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

Submission status: Accepted

Solution code:
s = sorted(map(str, input()))
t = sorted(map(str, input()))
if len(set(s)) == len(set(t)) == 1:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')
else:
    if ord(s[0]) < ord(t[-1]):
        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:
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(map(str, input().rstrip()))
t = list(map(str, input().rstrip()))

s.sort()
t.sort()
t = t[::-1]

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

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

Submission status: Accepted

Solution code:
def sort_words(s, reverse=False):
    s = sorted(s, reverse=reverse)
    return ''.join(s)


s = sort_words(input())
t = sort_words(input(), True)
print('Yes' if s < t else 'No')

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

list = sorted([s, t])
print('Yes' if (s == list[0] and s != t) else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = ''.join(sorted(input()))
t = ''.join(reversed(sorted(input())))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
##82_B
s = input()
t = input()

##'間に挿入する文字列'.join([連結したい文字列のリスト])
s_sort = "".join(sorted(s))
t_sort = "".join(sorted(t,reverse=True))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s1 = input()
s2 = input()
sorted_s1 = ''.join(sorted(s1))
sorted_s2 = ''.join(sorted(s2,reverse=True))
if sorted_s1 < sorted_s2:
  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
import math
import bisect
import re

def solve():
    s = input()
    t = input()
    s = ''.join(sorted(s))
    t = ''.join(sorted(t, reverse=True))
    return s < t

def main():
    if solve():
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
s = input()
t = input()
s0 = sorted([c for c in s])
t0 = sorted([c for c in t], reverse=True)
if s0 < t0:
  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 = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()), reverse=True))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = sorted([i for i in input()])
t = sorted([j for j in input()], reverse=True)

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

Submission status: Accepted

Solution code:
s=input()
t=input()
l_s=len(s)
l_t=len(t)

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

cnt=0

if l_s<=l_t:
    for i in range(l_s):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()
        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()
        else:
            cnt+=1

    if cnt==l_s==l_t:
        print("No")
    else:
        print("Yes")

else:
    for i in range(l_t):
        if ord(s[i])<ord(t[i]):
            print("Yes")
            exit()

        elif ord(s[i])>ord(t[i]):
            print("No")
            exit()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    s=list(input())
    t=list(input())
    s.sort()
    t.sort(reverse=1)
    l=[s,t]
    l.sort()
    YesNo(l[0]==s and s!=t)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC082 B

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

    list_s = []
    list_t = []

    for char in s:
        list_s.append(char)
    
    for char in t:
        list_t.append(char)
    
    if ''.join(sorted(list_s)) < ''.join(sorted(list_t)[::-1]):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s_uni = sorted([ord(i) for i in s])
t_uni = sorted([ord(i) for i in t], reverse = True)
for i in range(min(len(s), len(t))):
    if s_uni[i] < t_uni[i]:
        print('Yes')
        exit()
    elif s_uni[i] == t_uni[i]:
        continue
    else:
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
s_list = [s[i] for i in range(len(s))]
t = input()
t_list = [t[i] for i in range(len(t))]
s_list.sort()
t_list.sort(reverse=True)
n = min(len(s), len(t))

for i in range(n):
    if s_list[i] < t_list[i]:
        print('Yes')
        exit(0)
    elif s_list[i] == t_list[i]:
        if i != n - 1:
            continue
        else:
            if len(s) >= len(t):
                print('No')
            else:
                print('Yes')
            exit(0)

    else:
        print('No')
        exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
S=[]
T=[]
for i in range(len(s)):
  S.append(s[i])
S=sorted(S)
for i in range(len(t)):
  T.append(t[i])
T=sorted(T,reverse=True)
print('Yes' if S<T else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
s = list(input())
t = list(input())
#開業されたN個要素を受け付ける
#list = [input() for i in range(N)]
s = sorted(s)
t = reversed(sorted(t))

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

if strs < strt:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# アルファベットから数値への変換
alpha2num = lambda c: ord(c) - ord('a') + 1

s = input()
t = input()

s_indexs = []
t_indexs = []

for i in range(len(s)):
    s_indexs.append(alpha2num(s[i]))

for i in range(len(t)):
    t_indexs.append(alpha2num(t[i]))

s_indexs.sort()
t_indexs.sort(reverse = True)

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

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

print("Yes" if s2 < t2 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 = input()
t = input()

s = ''.join(sorted(s))
t = ''.join(sorted(t, reverse=True))
sort = sorted([s, t])
if s == t:
    print('No')
elif sort[0] == s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

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

    s_ord = [ord(i) for i in s]
    t_ord = [ord(i) for i in t]
    s_ord.sort()
    t_ord.sort(reverse=True)

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

sd = ""
td = ""

for i in range(len(s)):
    a = 0
    for j in range(len(s)):
        if s[j] < s[a]:
            a = j
    sd = sd + s.pop(a)

for i in range(len(t)):
    a = 0
    for j in range(len(t)):
        if t[a] < t[j]:
            a = j
    td = td + t.pop(a)

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
N=len(s)
M=len(t)

s.sort()
t.sort(reverse=True)
for i in range(min(N,M)):
    if t[i]>s[i]:
        print("Yes")
        exit()
    elif t[i]<s[i]:
        print("No")
        exit()
    else:
        continue

if N<M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

s_asc = ''.join(s)
t_desk = ''.join(t)

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

Submission status: Accepted

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

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

s_length = len(s)
t_length = len(t)

w1 = ''
w2 = ''

for a in range(0, s_length):
    w1 += s.pop(0)

for a in range(0, t_length):
    w2 += t.pop(0)

if w1 < w2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
s_ = sorted(s)
t = list(input())
t_ = sorted(t,reverse=True)
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=sorted(input())
t=sorted(input(),reverse=True)
ans='Yes'
for i in range(min(len(s),len(t))):
    if ord(s[i])<ord(t[i]):
        break
    elif ord(s[i])==ord(t[i]):
        ans='UN'
        continue
    else:
        ans='No'
        break
if ans=='UN':
    if len(t)>len(s):
        ans='Yes'
    else:
        ans='No'
print(ans)

Submission status: Accepted

Solution code:
s = list(input())

t = list(input())

s.sort(reverse = False)

t.sort(reverse = True)

k = [s,t]

k.sort()

if k[1] == t and s!= t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
s_list = sorted(list(s))
t_list = sorted(list(t),reverse=True)
s_hoge = ''.join(s_list)
t_hoge = ''.join(t_list)
if s_hoge < t_hoge:
  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 = input()
t = input()
 
S = "".join(sorted(s))
T = "".join(sorted(t, reverse=True))
 
if S<T:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
def main():
    s = sorted(input())
    t = sorted(input())[::-1]

    S = ','.join(s)
    T = ','.join(t)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
s = ''.join(sorted([i for i in rs()]))
t = ''.join(sorted([i for i in rs()], reverse=True))
print('Yes' if s < t else 'No')

Submission status: Accepted

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

ss = ''.join(sorted([c for c in s]))
ts = ''.join(sorted([c for c in t], reverse=True))

print('Yes' if ts > ss else 'No')

Submission status: Accepted

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

N, M = len(s), len(t)
min_len = min(N, M)

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


for a, b in zip(s_, t_):
    if a == b:
        continue
    elif a > b:
        print('No')
        exit()
    else:
        print('Yes')
        exit()

if N < M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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