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:
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if not check_equal:
    result = (f < s)
    break

if (length and check_equal) or result:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if f < s:
    result = True
    break
  elif f > s:
    result = False
    break

if (length and check_equal) or result:
  print('Yes')
else:
  print('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:
x = [sorted(list(input())) for _ in range(2)]
x[1] = list(reversed(x[1]))
y = sorted(x)
print(["No","Yes"][x==y and x[0] != x[1]])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s_1=sorted(s)
t_1=sorted(t,reverse=True)
"""
print(s_1)
print(t_1)
"""
if s_1 < t_1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = [list(input()) for _ in range(2)]
s[0].sort()
s[1].sort(reverse=True)
if ''.join(s[0]) < ''.join(s[1]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=sorted(input())
t=sorted(input(),reverse=True)
a=sorted([s,t])
if s==t:
    print("No")
    exit()
if a[0]==s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s_str = input()
t_str = input()
s = [s_str[i] for i in range(len(s_str))]
t = [t_str[i] for i in range(len(t_str))]
s.sort()
t.sort(reverse=True)
for i in range(min(len(s), len(t))):
    if s[i] > t[i]:
        print('No')
        exit()
    elif s[i] < t[i]:
        print('Yes')
        exit()
if len(s) < len(t):
    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=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 = 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())
s.sort()

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

j = 0
for i in s:
    if i < t[j]:
        print('Yes')
        break

    elif i > t[j]:
        print('No')
        break

    else:
        j += 1
        if j == len(t):
            print('No')
            break
        elif j == len(s):
            print('Yes')
            break

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

Submission status: Accepted

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

Submission status: Accepted

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

L = sorted([s,t])

if s==t:
    print("No")
elif L[0]==s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
t = input()
u = "".join(sorted([x for x in s]))
v = "".join(reversed(sorted([x for x in t])))

if u==v:
    print("No")
    exit(0)

W = sorted([u,v])
print("Yes" if W[0]==u else "No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
li =[]

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

if li[0] != s:
    print("No")
elif s == t:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s, t = input(), input()
s_lst, t_lst = [], []

for i in s:
    s_lst.append(i)

for j in t:
    t_lst.append(j)

s_lst.sort()
t_lst.sort(reverse=True)

s, t = "".join(s_lst), "".join(t_lst)
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(),reverse=True)
A = "No"
for sc,tc in zip(S,T):
    if sc == tc:
        continue
    elif sc < tc:
        A = "Yes"
        break
    else:
        break
if S == T[:len(S)] and len(S) < len(T):
    A = "Yes"
print(A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str_list1 = list(input())
str_list2 = list(input())
str_list2_inv = [i for i in sorted(str_list2)[::-1]]
str1 = ''.join(sorted(str_list1))
str2 = ''.join(str_list2_inv)
if str1 == str2:
    print('No')
elif sorted([str1,str2])[0] == str1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def alf(a):
   A = "abcdefghijklmnopqrstuvwxyz"
   for l in range(26):
      if a == A[l]:
         return l
   return -1

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

   S = []
   for s in s:
      S.append([alf(s), s])
   T = []
   for t in t:
      T.append([alf(t), t])
   
   S.sort()
   T.sort()
   T = T[::-1]
   for i in range(len(S)):
      if i == len(T):
         return "No"
      elif S[i] < T[i]:
         return "Yes"
      elif S[i] > T[i]:
         return "No"
   if len(S)==len(T):
      return "No"
   else:
      return "Yes"

print(main())

Submission status: Accepted

Solution code:
from collections import Counter
def rearange(x):
    counter=Counter(x)
    x_=''
    for i in range(26):
        num=ord('a')+i
        x_+=chr(num)*counter[chr(num)]
    return x_

s=input()
t=input()

s_=rearange(s)
t_=rearange(t)
t_=list(t_)
t_.sort(reverse=True)
t_=''.join(t_)
if s_<t_:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from itertools import zip_longest

def twoAnagrams(s, t):
    s_str = ''.join(sorted(s))
    t_str = ''.join(sorted(t, reverse=True))

    if t_str.startswith(s_str):
        if len(s_str) < len(t_str):
            return True
        # this implies s and t is the same string
        else:
            return False

    for s_chr,t_chr in zip_longest(s_str, t_str):
        if s_chr is None:
            return True
        elif t_chr is None or t_chr < s_chr:
            return False
        elif s_chr < t_chr:
            return True


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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

s = sorted(s)
t = sorted(t)
t = list(reversed(t))

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

Submission status: Accepted

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

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B


if __name__ == '__main__':
    s = sorted(list(input()))
    t = sorted(list(input()), reverse=True)

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

Submission status: Accepted

Solution code:
i=input
print(['No','Yes'][sorted(i())<sorted(i())[::-1]])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

s = arr_data[0][0]
t = arr_data[1][0]


#print(s,t)


arr1=[]
arr2=[]

for v in s:
    
    arr1.append(v)
    
arr1_sort=sorted(arr1)

for v in t:
    
    arr2.append(v)
    
arr2_sort=sorted(arr2,reverse=True)


str1="".join(arr1_sort)
str2="".join(arr2_sort)

#print(str1,str2)

if(str1<str2):
    
    print("Yes")
    
else:
    
    print("No")

Submission status: Accepted

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

ss = list(s)
tt = list(t)

ss.sort()
tt.sort(reverse=True)

s1 = ''.join(ss)
t1 = ''.join(tt)

if s1 < t1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
slist,tlist = [],[]
for i in s:
	slist.append(i)
for i in t:
	tlist.append(i)
slist.sort()
tlist.sort()
tlist = tlist[::-1]
for j in range(min(len(slist),len(tlist))):
	if ord(slist[j]) < ord(tlist[j]):
		print("Yes")
		break
	elif ord(slist[j]) > ord(tlist[j]):
		print("No")
		break
	else:
		if j == min(len(slist),len(tlist))-1:
			if len(slist) < len(tlist): print("Yes")
			else: print("No")

Submission status: Accepted

Solution code:
s = input()
ns = ''.join(sorted(s))
t = input()
nt = ''.join(sorted(t,reverse=True))
if ns<nt:
    print('Yes')
else:
    print('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 = input()
t = input()

s_sorted = ''.join(sorted(s))
t_sorted = ''.join(sorted(t, reverse = True))

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
l=max(len(s),len(t))
slist = []
tlist = []
for i in range(l):
    if i < len(s):
        slist.append(s[i])
    if i < len(t):
        tlist.append(t[i])
slist.sort()
tlist.sort(reverse=True)
result = 'Yes'
if s==t:
    result = 'No'
else:
    for j in range(l):
        if j < len(s) and j < len(t):
            if slist[j] == tlist[j]:
                continue
            elif slist[j] < tlist[j]:
                break
            else:
                result = 'No'
                break
        elif len(s) > len(t):
            result = 'No'
            break
print(result)

Submission status: Accepted

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

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

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

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


list =[s,t]
list = sorted(list)

if list[0] == s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s_input_sort = sorted(list(str(input())))
t_input_sort = sorted(list(str(input())), reverse=True)

s_str = "".join(s_input_sort)
t_str = "".join(t_input_sort)

if t_str > s_str:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s_input_sort = sorted(list(str(input())))
t_input_sort = sorted(list(str(input())), reverse=True)

s_str = "".join(s_input_sort)
t_str = "".join(t_input_sort)

if s_str == t_str:
    print("No")
else:    
    if t_str < s_str:
        print("No")
    else:
        print("Yes")

Submission status: Accepted

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

if sorted(S)<sorted(T,reverse=True):
    print('Yes')
else:
    print("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 = str(input())
t = str(input())
S = list(s)
T = list(t)
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:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def main():
    s, t = (line.strip() for line in sys.stdin.readlines())
    if sorted(s) < sorted(t, reverse=True):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

a.sort()
b.sort(reverse=True)

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

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

Submission status: Accepted

Solution code:
import sys

a=input()
b=input()
c=[]
d=[]
for i in range(len(a)):
    c.append(a[i])
for i in range(len(b)):
    d.append(b[i])
c.sort()
d.sort()
d.reverse()
for i in range(min([len(a),len(b)])):
    if(c[i]<d[i]):
        print("Yes")
        sys.exit()
if(len(a)<len(b)):
    if(a==b[0:len(a)]):
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

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

B_Two_Anagrams()

Submission status: Accepted

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

L = [list(map(str, input().split())) for _ in range(2)]
s, t = list(L[0][0]), list(L[1][0])

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

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

Submission status: Accepted

Solution code:
def main():
    S = "".join(sorted(list(input())))
    T = "".join(sorted(list(input()), reverse=True))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

import sys

s = raw_input().split()[0]
t = raw_input().split()[0]
#print s, t

sl = list(s)
sl.sort()
tl = list(t)
tl.sort(reverse=True)

# print sl
# print tl

if sl < tl:
    sys.stdout.write('Yes\n')
else:
    sys.stdout.write('No\n')
sys.stdout.flush()

Submission status: Accepted

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

Submission status: Accepted

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

sort_a = ''.join(sorted(a))
sort_b = sorted(b)
r_b = sort_b[::-1]
rbs = ''.join(r_b)

if sort_a<rbs:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

if sorted_s < reversed_t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc082/tasks/abc082_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(s, t):
    s.sort(reverse=False)
    t.sort(reverse=True)
    if t > s:
        return 'Yes'
    else:
        return 'No'


def main(args):
    s = list(input().strip())
    t = list(input().strip())
    ans = solve(s, t)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
s = list(map(lambda x: ord(x) - 96, input()))
t = list(map(lambda x: ord(x) - 96, input()))
N = len(s)
M = len(t)
s.sort()
t.sort(reverse=True)
s.extend([0] * max(M - N, 0))
t.extend([0] * max(N - M, 0))
for i in range(max(N, M)):
	if s[i] == t[i]:
		continue
	print("Yes" if s[i] < t[i] else "No")
	break
else:
	print("No")

Submission status: Accepted

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

ss = sorted(s)
tt = sorted(t, reverse=True)
print("Yes" if ss < tt else "No")

Submission status: Accepted

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

sL = [i for i in s]
tL = [i for i in t]
sL.sort()
tL.sort(reverse=True)

if sL < tL:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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



def main():
    S = input()
    T = input()

    ok = sorted(S) < sorted(T, reverse=True)
    print("Yes" if ok else "No")

if __name__ == "__main__": main()

Submission status: Accepted

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

solve()

Submission status: Accepted

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

Submission status: Accepted

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

ss = sorted(list(s))
tt = sorted(list(t))[::-1]

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

Submission status: Accepted

Solution code:


def foo(s, t):
    if "".join(sorted(list(s))) < "".join(sorted(list(t), reverse=True)):
        return "Yes"
    else:
        return "No"

if __name__ == "__main__":
    s = input()
    t = input()
    print(foo(s, t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#sを読み取り昇順にする
s = input()
s_asc = ''.join(sorted(s))
#tを読み取り降順にする
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_sorted = ''.join(sorted(s))
t_sorted = ''.join(sorted(t, reverse=True))

word_list = [s_sorted, t_sorted]
word_list.sort()

if word_list[0] == s_sorted and s_sorted != t_sorted:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
s = list(str(input()))
t = list(str(input()))
ss = sorted(s)
st = sorted(t)
rst = sorted(t, reverse=True)

if (len(s) < len(t)):
    if (''.join(ss) == ''.join(t[:len(s)])):
        print('Yes')
        sys.exit()
m = min(len(s), len(t))
for i in range(m):
    #print(ss[i] , rst[i])
    if (ss[i] < rst[i]):
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
sd = sorted(s,key=lambda a:ord(a))
td = sorted(t,key=lambda a:-ord(a))
if len(sd) == len(td):
    for sm, tm in zip(sd, td):
        if ord(sm) < ord(tm):
            print('Yes')
            exit()
        elif ord(sm) > ord(tm):
            print('No')
            exit()
    print('No')
else: 
    minsize = min(len(s), len(t))
    sd = sd[:minsize]
    td = td[:minsize]
    if sd == td:
        if len(s) < len(t):
            print('Yes')
        else:
            print('No')
    else:
        for sm, tm in zip(sd, td):
            if ord(sm) < ord(tm):
                print('Yes')
                exit()
            elif ord(sm) > ord(tm):
                print('No')
                exit()
        print('No')

Submission status: Accepted

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

s1 = ''.join(sorted(s))
t1 = ''.join(sorted(t, reverse=True))

print('Yes' if s1 < t1 else 'No')

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    S = list(input())
    T = list(input())
    S.sort()
    T.sort()
    T = list(reversed(T))
    if S < T:
        print ("Yes")
    else:
        print ("No")

Submission status: Accepted

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

s_sorted = ''.join(sorted(list(s)))
t_sorted = ''.join(reversed(sorted(list(t))))

if s_sorted < t_sorted:
    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 "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
ss = [x for x in s]
tt = [x for x in t]
sss = ''.join(sorted(ss))
ttt = ''.join(sorted(tt, reverse=True))
if sss < ttt:
    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)

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

Submission status: Accepted

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

for s in S:
    for t in T:
        if s < t:
            print("Yes")
            exit(0)
else:
    for s in S:
        if s not in T:
            print("No")
            break
    else:
        if len(S) < len(T):
            print("Yes")
        else:
            print("No")

Submission status: Accepted

Solution code:
l = list(str(raw_input()))
k = list(str(raw_input()))

l.sort()
l = "".join(l)
k = sorted(k, reverse=True)
k = "".join(k)

if l < k:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
S=input().strip()
T=input().strip()
s=[]
t=[]
for i in range(len(S)):
  s.append(str(S[i]))
for i in range(len(T)):
  t.append(str(T[i]))

s.sort()
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())

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

Submission status: Accepted

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

sList = []
for index in range(0,len(s)):
    sList.append(s[index])

tList = []
for index in range(0,len(t)):
    tList.append(t[index])

sList.sort()
tList.sort()
tList.reverse()

newS = ""
for word in sList:
    newS = newS + word

newT = ""
for word in tList:
    newT = newT + word

list = [newS, newT]
list.sort()

if list[0] == list[1]:
    print("No")
elif list[0] == newS:
    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:
# B - Two Anagrams
# coding: utf-8

A = list(raw_input())
B = list(raw_input())
A.sort()
B.sort(), B.reverse()

print "Yes" if A < B else "No"

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
S = input()
T = input()
num = 0
S = sorted(S)
T = sorted(T,reverse=True)
while num < min(len(S),len(T)):
    if  S[num] < T[num]:
        print('Yes')
        break
    elif S[num] > T[num]:
        print('No')
        break
    num += 1
if num == len(T):
    print('No')
elif num == len(S):
    print('Yes')

Submission status: Accepted

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

  sd=list(s)
  sd.sort()
  td=list(t)
  td.sort(reverse=True)

  for (sc,tc) in zip(sd,td):
    if sc<tc:
      print("Yes")
      return
  if len(sd)<len(td) and sd[len(sd)-1]==td[len(sd)-1]:
    print("Yes")
    return
  print("No")

main()

Submission status: Accepted

Solution code:
#sを最高のパターンにして，tを最悪のパターンにすればいい
#continueで強制的に次のループへ
s = list(input())
t = list(input())
condition = 0

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

if len(s)  == len(t):
    length = len(s)
    pattern = -1
elif len(s) < len(t):
    length = len(s)
    pattern = 0
else:#sのほうが長い時 pattern = 1
    length = len(t)
    pattern = 1

if pattern == -1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            condition =1
            break
        else:
            print("No")
            condition =1
            break
    if condition == 0:
        print("No")
elif pattern == 0:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            condition =1
            break
        else:
            print("No")
            condition =1
            break
    
    if condition == 0:
        print("Yes")
elif pattern == 1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            condition =1
            break
        else:
            print("No")
            condition =1
            break
            
    if condition == 0:
        print("No")

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    t = S()
    s = ''.join(sorted([c for c in s]))
    t = ''.join(sorted([c for c in t], reverse=True))
    if s < t:
        return 'Yes'

    return 'No'



print(main())

Submission status: Accepted

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

import sys

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
#s,t = map(list, input().split())
s = list(input())
t = list(input())

if len(s) < len(t):
    t2 = t.copy()
    for l in s:
        if l in t2:
            del t2[t2.index(l)]
        else:
            break
    else:
        print('Yes')
        sys.exit()

s.sort()
t.sort()

if s[0] < t[-1]:
    print ('Yes')
    sys.exit()
    
print('No')