Problem:


Score : 200 points

Problem Statement

You are given strings s and t, consisting of lowercase English letters.
You will create a string s' by freely rearranging the characters in s.
You will also create a string t' by freely rearranging the characters in t.
Determine whether it is possible to satisfy s' < t' for the lexicographic order.

Notes

For a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M, we say a < b for the lexicographic order if either one of the following two conditions holds true:

N < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.

There exists i (1 \leq i \leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.

For example, xy < xya and atcoder < atlas.

Constraints

The lengths of s and t are between 1 and 100 (inclusive).

s and t consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

s
t

Output

If it is possible to satisfy s' < t', print Yes; if it is not, print No.

Sample Input 1

yx
axy

Sample Output 1

Yes

We can, for example, rearrange yx into xy and axy into yxa. Then, xy < yxa.

Sample Input 2

ratcode
atlas

Sample Output 2

Yes

We can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort < tslaa.

Sample Input 3

cd
abc

Sample Output 3

No

No matter how we rearrange cd and abc, we cannot achieve our objective.

Sample Input 4

w
ww

Sample Output 4

Yes

Sample Input 5

zzz
zzz

Sample Output 5

No



Sample input:
yx
axy


Sample output:
Yes

Submission status: Accepted

Solution code:
s = input()
t = input()
S = list(s)
S.sort()
T = list(t)
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 = sorted(s)
S = "".join(s)

t = sorted(t)
t = t[::-1]
T = "".join(t)

L = [S, T]


LL = sorted(L)
if S == T:
	print("No")
else:
	if LL[0] == S:
		print("Yes")
	else:
		print("No")

Submission status: Accepted

Solution code:
s = ''.join(sorted(list(input())))
t = ''.join(list(reversed(sorted(list(input())))))

a = [s, t]

if a != sorted(a) or s == t:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print("YNeos"[sorted(input()) >= sorted(input(), reverse = True)::2])

Submission status: Accepted

Solution code:
a=str(input())
b=str(input())
A=[]
B=[]
for i in a:
   A.append(i)
   A=sorted(A)
for h in b:
   B.append(h)
   B.sort(reverse=True)

if A<B:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
S = sorted(S)
T = sorted(T,reverse = True)
counter = 0
l = min(len(S), len(T))
for i in range(l) :
    if S[i] > T[i] :
        print("No")
        break
    elif S[i] < T[i] :
        print("Yes")
        break
    else :
        counter += 1
    if counter == l :
        if len(S) >= len(T) :
            print("No")
            break
        else :
            print("Yes")
            break

Submission status: Accepted

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

S = sorted([x for x in s])
T = sorted([x for x in t])[::-1]
s = "".join(S)
t = "".join(T)
if s == t:
    print("No")
    exit(0)

A = sorted([s,t])
print("Yes" if A[0]==s else "No")

Submission status: Accepted

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


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

s2 = ''.join(sorted(list(s)))
t2 = ''.join(sorted(list(t),reverse=True))

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = lc()
t = lc()

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

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

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

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

Submission status: Accepted

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

st = sorted([s, t])

if s == t and len(set(s)) == 1 and len(set(t)) == 1:
    print('No')
else:
    if st[0] == s:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
s = sorted(input())
t = sorted(input(), reverse=True)
len_s = len(s)
len_t = len(t)
n_passed = 0

min_len = min(len_s, len_t)
for i in range(min_len):
    if s[i] < t[i]:
        print("Yes")
        exit()

if len_s < len_t:
    t = sorted(t)
    for i in range(len_s):
        if s[i] == t[i]:
            n_passed += 1
    if n_passed == len_s:
        print("Yes")
        exit()
        
print("No")

Submission status: Accepted

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

a = "".join(sorted(s))
b = "".join(reversed(sorted(t)))

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

Submission status: Accepted

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

if "".join(sorted(s)) < "".join(sorted(t, reverse=True)):
    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=[]
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(reverse=True)
count=0
for i in range(min(len(s),len(t))):
    if S[i]<T[i]:
        print("Yes")
        count=1
        break
    if S[i]>T[i]:
        print("No")
        count=1
        break
if count==0:
    if len(s)<len(t):
        print("Yes") 
    else:
        print("No")

Submission status: Accepted

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

s_arr=[]
t_arr=[]
for x in s:
    s_arr.append(ord(x)-ord('a'))
for x in t:
    t_arr.append(ord(x)-ord('a'))
s_arr=sorted(s_arr)
t_arr=sorted(t_arr)
t_arr.reverse()
if len(s_arr)>len(t_arr):
    t_arr+=[-1]*(len(s_arr)-len(t_arr))
elif len(s_arr)<len(t_arr):
    s_arr+=[-1]*(len(t_arr)-len(s_arr))
ans='No'
for i in range(len(s_arr)):
    if s_arr[i]<t_arr[i]:
        ans='Yes'
        break
    elif s_arr[i]>t_arr[i]:
        ans='No'
        break
    else:
        pass
print(ans)

Submission status: Accepted

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

S = sorted(S)
tmp = ['','']
for s in S:
    tmp[0] += s
T = sorted(T)
for t in T[::-1]:
    tmp[1] += t
if tmp[0] == tmp[1]:
    print('No')
    exit()
tmp2 = sorted(tmp)
if tmp2[0] == tmp[0]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

s_str = ""
t_str = ""
for c in s_list:
	s_str += c
for c in t_list:
	t_str += c

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = sorted(input())
t = sorted(input(), reverse = True)
if len(s) >= len(t):
  lenth = len(t)
else:
  lenth = len(s)
count = 0
while (s[count] == t[count]) and (lenth - 1 > count):
  count += 1
if s[count] == t[count]:
  if len(s) < len(t):
    print("Yes")
  else:
    print("No")
else:
  if s[count] < t[count]:
    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_list = list(s)
t_list = list(t)
s_list.sort()
t_list.sort()
t_list.reverse()
if s_list < t_list:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
listS=list(input())
listT=list(input())
alphaL =  [chr(i) for i in range(97,97+26)]
listS.sort()
listT.sort()
listT.reverse()

if alphaL.index(listS[0]) < alphaL.index(listT[0]):
    print("Yes")
else:
    if len(listS) < len(listT):
        listS.reverse()
        index=0
        while index < len(listS):
            if listS[index]!=listT[index]:
                print("No")
                break
            else:
                index+=1
        if index == len(listS):
            print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
ss = list(input())
tt = list(input())
ss.sort()
tt.sort()
tt.reverse()
print('Yes' if ss < tt else 'No')

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
s_list = list(s)
t_list = list(t)
s_list.sort()
t_list.sort()
t_list = t_list[::-1]
count = 0
while count < max(len(s_list), len(t_list)):
    if s_list[count] > t_list[count]:
        print("No")
        break
    if s_list[count] < t_list[count]:
        print("Yes")
        break
    if s_list[count] == t_list[count]:
        if count + 1 == min(len(s_list), len(t_list)):
            if len(s_list) >= len(t_list):
                print("No")
                break
            else:
                print("Yes")
                break
        else:
            count += 1
            continue
        break

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
n = len(s)
m = len(t)
s.sort()
t.sort()
t = t[-1::-1]
a = b = ""
for i in range(n):
    a += s[i]
for i in range(m):
    b += t[i]
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)
if ''.join(s) < ''.join(t) :
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
S=''.join(sorted(s))
T=''.join(sorted(t)[::-1])
L=sorted([S,T])

if S==T:
  print('No')
else:
  if L[0]==S:
    print('Yes')
  else:
    print('No')

Submission status: Accepted

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

s = ''.join(sorted(s))
t = ''.join(sorted(t)[::-1])
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
Alphabet = list(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
)

flag = 0
S = sorted(s)
T = sorted(t,reverse = True)
for i in range(min(len(S),len(T))) :
    if S[i] == T[i] :
        flag += 1
    else :
        for j in range(len(Alphabet)) :
            if S[i] == Alphabet[j] :
                print("Yes")
                flag += -10000
                break
            elif T[i] == Alphabet[j] :
                print("No")
                flag += -10000
                break
            else :
                continue
        break
    
if flag == min(len(S),len(T)) :
    if len(S) >= len(T) :
        print("No")
    elif s != t :
        print("Yes")
    else :
        print("No")
#print(Alphabet)

Submission status: Accepted

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

s_dash = ''.join(sorted(s))
t_dash = ''.join(sorted(t)[::-1])

test = [s_dash, t_dash]

if s_dash == t_dash:
    print("No")
else:
    if sorted(test)[0] != s_dash:
        print("No")
    else:
        print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

''.join(s)
''.join(t)

for i in range(0,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()
t=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:
s=list(input())
t=list(input())
sd="".join(sorted(s))
td="".join(sorted(t,reverse=True))
if sd<td:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
s = [i for i in s]
t = [i for i in 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:
s=sorted;print(s(input())<s(input(),reverse=1)and"Yes"or"No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=sorted;print(['No','Yes'][s(input())<s(input(),reverse=1)])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
t.reverse()
s=''.join(s)
t=''.join(t)
u=[]
u.append(s)
u.append(t)
u.sort()
print("Yes" if u[0]==s and s!=t else "No")

Submission status: Accepted

Solution code:
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    s = sorted(input())
    t = sorted(input(), reverse=True)
    if s < t:
        print(Yes)
    else:
        print(No)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

sd = "".join(sorted(list(S)))
td = "".join(sorted(list(T), reverse=True))

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

Submission status: Accepted

Solution code:
#82b
s=sorted(list(input()))
t=sorted(list(input()))
t=t[::-1]

ss=''.join(s)
tt=''.join(t)

ans=sorted([tt,ss])

if ss==tt:
    print('No')
else:
    print(['No','Yes'][ans[0]==ss])

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

ss = list(input())
tt = list(input())
ss.sort()
tt.sort(reverse=True)
S = ''
T = ''
for s in ss:
	S = S + s
for t in tt:
	T = T + t

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
flag = True
i = 0
ans = False
while flag:
    ans = False
    for x in t:
        if s[i] < x:
            flag = False
            ans = True
        elif s[i] == x:
            ans = True
    if ans and flag:
        t.remove(s[i])
        if i + 1 < len(s):
            i += 1
        elif t == []:
            flag = False
            ans = False
        else:
            flag = False
            ans = True
    elif not ans:
        flag = False
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

ss = ''.join(s)
tt = ''.join(t)

ans = sorted([tt,ss])

if ss == tt:
    print('No')
else:
    print(['No', 'Yes'][ans[0] == ss])

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

ss = ''
tt = ''
for i in range(len(s)):
    ss += s[i]
for i in range(len(t)):
    tt += t[i]

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s=input()
lists=[]
for i in range(len(s)):
    lists.append(s[i])
    
t=input()
listt=[]
for j in range(len(t)):
    listt.append(t[j])
    
lists.sort()
listt.sort(reverse=True)

list1=[lists,listt]
list1.sort()
if lists==listt:
    print("No")
elif list1[0]==lists:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t,reverse=True)
counter = 0
for i in range(min(len(s),len(t))) :
    if s[i] != t[i] :
        L = []
        L.append(s[i])
        L.append(t[i])
        K = sorted(L)
        if L[0] == K[0] :
            print("Yes")
            break
        else :
            print("No")
            break
    else :
        counter += 1
        continue
if counter == min(len(s),len(t)) :
    if len(s) < len(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="".join(list(sorted(input())))
b="".join(list(sorted(input()))[::-1])
u=list(sorted([a,b]))
if u[0]==u[1]:
  print("No")
elif u[0]==a:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s.sort()
t.sort()

t1 = t[::-1]

s2 = ''.join(s)
t2 = ''.join(t1)

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

Submission status: Accepted

Solution code:
s=input()
t=input()
a,b=[],[]
for i in s:
    a.append(ord(i))
for i in t:
    b.append(ord(i))
a.sort()
b.sort()
b=b[::-1]

for i in range(min(len(a),len(b))):
    if a[i]>b[i]:
        print("No")
        exit()
    elif a[i]<b[i]:
        print("Yes")
        exit()
print("Yes" if len(a)<len(b) else "No")

Submission status: Accepted

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

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

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

    if len(set(s)) == 1 and len(set(t)) == 1 and set(s) == set(t) and len(s) < len(t):
        print('Yes')
        exit()
 
    for i in range(min(len(s), len(t))):
        if ord(s[i]) < ord(t[i]):
            print('Yes')
            exit()
    print('No')
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from itertools import zip_longest

s = input()
t = input()

tmp = list(s)
tmp.sort()
s_ = "".join(tmp)

tmp = list(t)
tmp.sort(reverse=True)
t_ = "".join(tmp)

st_ = [s_, t_]
st_.sort()

if s_ == t_:
    print("No")
elif st_[0] == s_:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力

s = input()
t = input()
# s = "ratcode"
# t = "atlas"

# a = int(input())
# # スペース区切りの整数の入力
# b, c = map(int, input().split())
# # 文字列の入力
# s = input()
s = list(s)
t = list(t)
s.sort()
t.sort()
t.reverse()

t2 = ''.join(t)
s2 = ''.join(s)

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

# f =False
# for sc,tc in zip(s,t):
#   # print(sc+" "+tc)
#   if tc > sc:
#     f=True
#     break;
#   if tc < sc:
#     f=False
#     break;

# if f:
#   print("Yes")
# else:
#   print("No")

# 出力
# print("{} {}".format(a+b+c, s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = list(s)
s.sort()
s = "".join(s)

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

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

Submission status: Accepted

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

if ''.join(map(str, t))>''.join(map(str, s)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
https://abc082.contest.atcoder.jp/tasks/abc082_b
"""
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()
st = sorted(s)
tt = sorted(t)
tt.reverse()
if st<tt:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

s.sort()
t.sort()

t.reverse()

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

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

Submission status: Accepted

Solution code:
s = input()
t = input()
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
    "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

s_m = l.index(s[0])
s_M = l.index(s[0])
for i in s:
    if l.index(i) < s_m:
        s_m = l.index(i)
    if l.index(i) > s_M:
        s_M = l.index(i)

t_m = l.index(t[0])
t_M = l.index(t[0])
for j in t:
    if l.index(j) < t_m:
        t_m = l.index(j)
    if l.index(j) > t_M:
        t_M = l.index(j)

if s_m == s_M == t_m == t_M:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")
elif s_m < t_M:
    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:
# -*- coding: utf-8 -*-

s_list = list(input())
t_list = list(input())

# 昇順ソート
s_list.sort()
# 降順ソート
t_list.sort(reverse=True)

# 文字列の並び順も比較演算子で大小比較できる
if "".join(s_list) < "".join(t_list):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s_list = list(input())
t_list = list(input())

# 昇順ソート
s_list.sort()
# 降順ソート
t_list.sort(reverse=True)

res_list = []
res_list.append("".join(s_list))
res_list.append("".join(t_list))
res_list.sort()

# 比較対象が同一文字列の場合はNoにする(s<=tではなくs<tだから)
if "".join(s_list) == "".join(t_list):
    print("No")
# ソート後の先頭と文字列sの一致を確認
elif res_list[0] == "".join(s_list):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

while len(s)>0 and len(t)>0:
    if min(s)<max(t):
        print("Yes")
        exit()
    elif min(s)==max(t):
        del s[0]
        del t[len(t)-1]
    else:
        print("No")
        exit()
if len(t)==0:
    
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = [i for i in s]
s.sort()
t = [i for i in t]
t.sort(reverse=True)
if s<t:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

for i in range(len(s)):
    S.append(s[i])
    
for i in range(len(t)):
    T.append(t[i])
    
S.sort()
T.sort()
T.reverse()

if S == T:
    print('No')
    
elif min(S, T) == S:
    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:
print(('No','Yes')[sorted(input()) < sorted(input())[::-1]])

Submission status: Accepted

Solution code:
d = dict()
d['a'] = 1
d['b'] = 2
d['c'] = 3
d['d'] = 4
d['e'] = 5
d['f'] = 6
d['g'] = 7
d['h'] = 8
d['i'] = 9
d['j'] = 10
d['k'] = 11
d['l'] = 12
d['m'] = 13
d['n'] = 14
d['o'] = 15
d['p'] = 16
d['q'] = 17
d['r'] = 18
d['s'] = 19
d['t'] = 20
d['u'] = 21
d['v'] = 22
d['w'] = 23
d['x'] = 24
d['y'] = 25
d['z'] = 26

e = dict()
e[1] = 'a'
e[2] = 'b'
e[3] = 'c'
e[4] = 'd'
e[5] = 'e'
e[6] = 'f'
e[7] = 'g'
e[8] = 'h'
e[9] = 'i'
e[10] = 'j'
e[11] = 'k'
e[12] = 'l'
e[13] = 'm'
e[14] = 'n'
e[15] = 'o'
e[16] = 'p'
e[17] = 'q'
e[18] = 'r'
e[19] = 's'
e[20] = 't'
e[21] = 'u'
e[22] = 'v'
e[23] = 'w'
e[24] = 'x'
e[25] = 'y'
e[26] = 'z'

s = input()
t = input()
lists = []
listt = []
for i in range(len(s)):
	lists.append(d[s[i]])
for i in range(len(t)):
	listt.append(d[t[i]])
lists.sort()
listt.sort()
listt.reverse()
check = True
for i in range(len(s)):
	if i < len(listt):
		if lists[i] < listt[i]:
			check = True
			break
		elif lists[i] > listt[i]:
			check = False
			break
		else:
			if i != len(t)-1:
				check = True
			else:
				check = False
if check:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

s.sort()
t.sort()
t = 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()
t.reverse()
s = "".join(s)
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)

j = 0

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

Submission status: Accepted

Solution code:
s = input()
t = input()
alp = "abcdefghijklmnopqrstuvwxyz"
S = ""
T = ""
for i in range(len(alp)):
    for j in range(len(s)):
        if alp[i] == s[j]:
            S += s[j]
for i in range(len(alp)):
    for j in range(len(t)):
        if alp[i] == t[j]:
            T += t[j]
TT = T[::-1]
if S < TT:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

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

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

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

Submission status: Accepted

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

s_sorted = "".join(sorted(s))
t_sorted = "".join(reversed(sorted(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))
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:
s=input().strip()
t=input().strip()
s=''.join(sorted(s))
t=''.join(sorted(t,reverse=True))
print(['No','Yes'][s<t])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
first = sorted(input(''))
second = sorted(input(''), reverse=True)
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 (len(first) < len(second) 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)
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 (len(first) < len(second) and check_equal) or result:
  print('Yes')
else:
  print('No')