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:
A = sorted(input())
B = sorted(input())[::-1]
if A < B:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if "".join(sorted(S)) < "".join(reversed(sorted(T))):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

st = [''.join(c) for c in [s,t]]

if st[0] == st[1]:  print('No')
elif st == sorted(st):    print('Yes')
else:   print('No')

Submission status: Accepted

Solution code:


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:
if sorted(input()) < sorted(input())[::-1]:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s, t = sorted(input()), sorted(input())[::-1]
print("YNeos"[sorted([s,t])[0]==t::2])

Submission status: Accepted

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

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

    s = list(s)
    s.sort()
    s2 = ""
    for moji in s:
        s2 += moji

    t = list(t)
    t.sort(reverse=True)
    t2 = ""
    for moji in t:
        t2 += moji
    
    if s2 < t2:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    solve()

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

Submission status: Accepted

Solution code:
from sys import stdin
s = "".join(sorted(list(stdin.readline().rstrip())))
t = "".join(reversed((sorted(list(stdin.readline().rstrip())))))
if s < t:
    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()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if len(s) < len(t):
    for i in range(len(s)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(s):
        print("Yes")

else:
    for i in range(len(t)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(t):
        print("No")

Submission status: Accepted

Solution code:

from functools import reduce 

ss = input()
st = input()


ls = [c for c in ss]
lt = [c for c in st]

#print(ls)


ls.sort()
lt.sort(reverse = True)

ans_s = reduce( lambda x,y: x+y, ls,'' )
ans_t = reduce(lambda x, y: x+y, lt)


#print((ans_s, ans_t))
#ans_s.
print( 'Yes' if ans_s < ans_t else 'No' )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=list(input())
b=list(input())
a.sort()
b.sort(reverse=True)
print(["No","Yes"]["".join(a)<"".join(b)])

Submission status: Accepted

Solution code:
# 入力
s=list(input())
t=list(input())

# sを辞書順最小に
s.sort()
s=''.join(s)

# tを辞書順最大に
t.sort()
t.reverse()
t=''.join(t)

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

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    s = list(_ for _ in input())
    t = list(_ for _ in input())
    s.sort()
    t.sort()
    t=t[::-1]
    if ''.join(s) <''.join(t):        
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = [i for i in input()]
t = [j for j in input()]
s.sort()
t.sort(reverse=True)
flag = False

for i in range(min(len(s), len(t))):
  if s[i] < t[i]:
    print("Yes")
    flag = True
    break
  else:
    pass
  
if flag:
  pass
else:
  if len(s) < len(t) and len(set(s)) == len(set(t)):
    print("Yes")
  else:
    print("No")

Submission status: Accepted

Solution code:
import itertools
import math
s1 = input()
s1 = list(s1)
s1.sort()
s1 ="".join(s1)
s2 = input()
s2 = list(s2)
s2.sort(reverse=True)
s2 ="".join(s2)
if s1 < s2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

#A
def A():
    return

#B
def B():
    s = S()
    t = S()
    s.sort()
    t.sort(reverse = True)
    if s < t:
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    n = I()
    d = [None for i in range(n+1)]
    d[0] = 2
    d[1] = 1
    for i in range(2,n+1):
        d[i] = d[i-1]+d[i-2]
    print(d[n])
    return

#D
def D():
    x,y,z = LI()
    for i in range(1000000)[::-1]:
        if i*y+(i+1)*z <= x:
            print(i)
            quit()
    return

#E
def E():
    d = [(1,0),(-1,0),(0,1),(0,-1)]
    h,w = LI()
    s = SR(h)
    for i in range(h):
        for j in range(w):
            if s[i][j] == "#":
                su = 0
                for dy,dx in d:
                    y = i+dy
                    x = j+dx
                    if 0 <= y < h and 0 <= x < w:
                        if s[y][x] == "#":
                            su += 1
                if su == 0:
                    print("No")
                    quit()
    print("Yes")
    return

#F
def F():
    a,b,c,X,Y = LI()
    ans = float("inf")
    for z in range(300001):
        if z%2 == 0:
            m = c*z
            x = z//2
            y = z//2
            m += a*max(0,X-x)
            m += b*max(0,Y-y)
            if m < ans:
                ans = m
    print(ans)
    return

#G
def G():
    n = I()
    x = LI()
    f = [(i,x[i]) for i in range(n)]
    f.sort(key = lambda x:x[1])
    g = [(f[i][0],i) for i in range(n)]
    g.sort(key = lambda x:x[0])
    for i in range(n):
        if g[i][1] < n//2:
            print(f[n//2][1])
        else:
            print(f[n//2-1][1])
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

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

Submission status: Accepted

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

Submission status: Accepted

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

import math

alpha = 'abcdefghijklmnopqrstuvwxyz'

s = input()
t = input()

if s in t and s != t:
    print('Yes')
    exit()
if s == t:
    print('No')
    exit()
if t in s and s != t:
    print('No')

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

for i in range(min(len(s),len(t))):
    for k in range(26):
        if s[i] == alpha[k]:
            x = k
        if t[i] == alpha[k]:
            y = k
    #print(x,y)
    if x < y:
        print('Yes')
        exit()
    if y < x:
        print('No')
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(min(len(s),len(t))):
    if s[i]==t[i]:
        count=1
        continue
    elif s[i]<t[i]:
        count=2
        break
    else:
        count=0
        break
if count==1:
    if len(s)<len(t):
        print('Yes')
    else:
        print('No')
elif count==2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=[x for x in input()]
t=[x for x in input()]
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:
S = sorted([c for c in input()])
T = sorted([c for c in input()], reverse=True)

for i in range(min(len(S), len(T))):
    if S[i] == T[i]:
        continue
    elif S[i] < T[i]:
        print('Yes')
        break
    else:
        print('No')
        break
else:
    if len(S) < len(T):
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    s, t = [stdin.readline().rstrip() for _ in range(2)]
    s = ''.join(sorted(s))
    t = ''.join(sorted(t, reverse=True))
    print('Yes' if s < t else 'No')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if s_firstest < t_latest:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
s = list(input())
s.sort()
t = list(input())
t.sort(reverse = True)
for i in range(min(len(s),len(t))):
    if ord(s[i]) < ord(t[i]):
        print("Yes")
        sys.exit()
    elif ord(s[i]) > ord(t[i]):
        print("No")
        sys.exit()
print("Yes" if len(s) < len(t) else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=''.join(sorted(input()))
t=''.join(sorted(input())[::-1])
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=list(input())
t=list(input())
S=sorted(s)
T=sorted(t,reverse=True)
for i in range(min(len(S),len(T))):
  if ord(S[i])<ord(T[i]):
    print('Yes')
    break
  elif ord(S[i])>ord(T[i]):
    print('No')
    break
else:
  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)
flag_no = 0
i = 0
n = len(s)
m = len(t)
while True:
  if s[i] > t[i]:
    flag_no = 1
    break
  elif s[i] < t[i]:
    flag_no = 0
    break
  else:
    if i == n-1:
      if n < m:
        flag_no = 0
        break
      else:
        flag_no = 1
        break
    elif i == m-1:
      flag_no = 1
      break
  i += 1
if flag_no == 1:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
a = sorted(list(input()))
b = sorted(list(input()))[::-1]
l = sorted(["".join(a),"".join(b)])

if l[0] == "".join(a) and a != b:
  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 = str(input())
t = str(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(str(input()))
t = list(str(input()))

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

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

Submission status: Accepted

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

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
def main():
    c = 'abcdefghijklmnopqrstuvwxyz'
    x = sorted(input())
    y = sorted(input(), reverse=True)
    if x == y[:len(x)] and len(y) > len(x):
        print('Yes')
    else:
        if c.index(x[0]) >= c.index(y[0]):
            print('No')
        else:
            print('Yes')


main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
  s = input()
  t = input()
  s2 = ''.join(sorted(s))
  t2 = ''.join(sorted(t)[::-1])
  if s2 < t2:
    print('Yes')
  else:
    print('No')


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
s=input()
t=input()
s_list=[s[i] for i in range(len(s))]
t_list=[t[j] for j in range(len(t))]
s_list.sort()
t_list.sort(reverse=True)
ss=""
for k in range(len(s_list)):
    ss+=s_list[k]
tt=""
for l in range(len(t_list)):
    tt+=t_list[l]
if ss<tt:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

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

    s = sorted(s)
    t = sorted(t)

    for i in s:
        for j in t:
            if ord(i)< ord(j):
                print('Yes')
                return


    if len(s)<len(t):
        ok = 1
        for i in s:
            if i not in t:
                ok = 0
        if ok:
            print('Yes')
            return


    print('No')

solve()

Submission status: Accepted

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

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

print(["Yes", "No"][not(s < t)])

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(str(input()))
t = sorted(str(input()))[::-1]
a = ["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"]
for i in range(min(len(s),len(t))):
    if t[i] > s[i]:
        print("Yes")
        break
    elif len(set(s)) == len(set(t)):
        if len(s) < len(t):
            print("Yes")
            break
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def read_input():
    s = input()
    t = input()
    return s, t


# s<tをチェックする
def greater_check(s, t):
    if len(s) < len(t):
        if s == t[:len(s)]:
            return True

    for i in range(min(len(s), len(t))):
        if s[i] < t[i]:
            return True

    return False

def submit():
    s, t = read_input()

    sc = [c for c in s]
    tc = [c for c in t]

    sc.sort()
    tc.sort(reverse=True)

    if greater_check(''.join(sc), ''.join(tc)):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    submit()

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

if s[0] < t[-1]:
  print("Yes")
elif s[0] > t[-1]:
  print("No")
else:
  if s == t:
    print("No")
  elif "".join(s) in "".join(t):
    print("Yes")
  else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC082B - Two Anagrams
s = sorted(input().rstrip())
t = sorted(input().rstrip(), reverse=True)
print("Yes" if s < t else "No")

Submission status: Accepted

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

S.sort()
T.sort()
T = T[::-1]

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

print(['No', 'Yes'][(S < T)])

Submission status: Accepted

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

S = sorted(S)
T = sorted(T)[::-1]

print(['No', 'Yes'][(S < T)])

Submission status: Accepted

Solution code:

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

    s1 = [ord(s) - ord('a') for s in S]
    t1 = [ord(t) - ord('a') for t in T]

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


    for i, j in zip(s1, t1):
        if i < j:
            print('Yes')
            return

    if (len(s1) < len(t1)) & (i > j):
        print('No')
        return
    elif (len(s1) < len(t1)):
        print('Yes')
        return

    print('No')

main()

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()
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:
import sys
from collections import Counter

s = input()
t = input()
s_list = []
t_list = []

for i in s:
    s_list.append(ord(i))

for i in t:
    t_list.append(ord(i))

s_list.sort()
t_list.sort(reverse=True)

for i in range(min(len(s_list), len(t_list))):
    if t_list[i] > s_list[i]:
        print('Yes')
        sys.exit()

if set(s_list) == set(t_list) and len(s_list) < len(t_list):
    print('Yes')
else:
    print('No')

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if s2 < t2:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = ''.join(sorted(list(input())))
t = ''.join(reversed(sorted(list(input()))))
S = sorted([s, t])
print('Yes' if s == S[0] and t != S[0] else 'No')

Submission status: Accepted

Solution code:
s = input()
t = input()
s = "".join(sorted(s))
t = "".join(sorted(t, reverse=True))
#print(s)
#print(t)
N = min(len(s), len(t))
f = False
for i in range(N):
  if s[i] < t[i]:
    print('Yes')
    f = True
    break
  elif s[i] > t[i]:
    print('No')
    f = True
    break
if not f:
  if len(s) < len(t):
    print('Yes')
  else:
    print('No')

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math


def srt(s, b):
  s = sorted(s)
  if b:
    s.reverse()
  ret = ""
  for c in s:
    ret += c
  return ret

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

s = srt(s,False)
t = srt(t,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, t = [list(input()) for _ in range(2)]
s.sort()
t.sort(reverse=True)
if s < t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    a = ''.join(sorted(input()))
    b = ''.join(sorted(input(), reverse=True))

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




main()

Submission status: Accepted

Solution code:
print(["No","Yes"]["".join(map(str,sorted(input())))<"".join(map(str,sorted(input(),reverse=True)))])

Submission status: Accepted

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

bool = False

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

Submission status: Accepted

Solution code:
s,t=sorted(input()),sorted(input())
for i in range(min(len(s),len(t))):
    if ord(s[i])<ord(t[-i-1]):
        print("Yes")
        break
    elif ord(s[i])>ord(t[-i-1]):
        print("No")
        break
else:
    print("Yes" if len(s)<len(t) else "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:
alpha='abcdefghijklmnopqrstuvwxyz'
from collections import defaultdict
datas=defaultdict(int)
datat=defaultdict(int)
for s in input():
    datas[s]+=1
for t in input():
    datat[t]+=1
S=''
for k in alpha:
    S+=k*datas[k]
T=''
alpha=alpha[::-1]
for k in alpha:
    T+=k*datat[k]
alpha=alpha[::-1]
if len(S)<len(T) and S==T[:len(S)]:
    print('Yes')
elif S==T:
    print('No')
elif len(S)>len(T) and T==S[:len(T)]:
    print('No')
else:
    for i in range(min(len(S),len(T))):
        if alpha.index(S[i])<alpha.index(T[i]):
            print('Yes')
            break
        elif alpha.index(S[i])>alpha.index(T[i]):
            print('No')
            break

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
S=list(input())
S.sort()
T=list(input())
T.sort(reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [i for i in input()]
t = [i for i in 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()
a=sorted(s)
b=sorted(t,reverse=True)
s="".join(a)
t="".join(b)
if s<t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math

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=input()
t=input()
s_list=[]
t_list=[]
x=""
y=""
for i in range(len(s)):
    s_list.append(s[i])
for i in range(len(t)):
    t_list.append(t[i])
s_list.sort()
t_list.sort(reverse=True)
for i in range(len(s)):
    x+=s_list[i]
for i in range(len(t)):
    y+=t_list[i]
if(x<y):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

print('Yes') if ls < lt else print('No')

Submission status: Accepted

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

ls = len(s)
lt = len(t)

p='No'
for i in range(100):
  if len(t)<=i:
    p = 'No'
    break
  if len(s)<=i:
    p = 'Yes'
    break 
  if s[i:i+1] > t[i:i+1]:
    p = 'No'
    break
  elif s[i:i+1] < t[i:i+1]:  
    p = 'Yes'
    break
   
print(p)

Submission status: Accepted

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

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

print("YNeos"[s>=t::2])

Submission status: Accepted

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

s_list = []
for i in range(len(s)):
    s_list.append(s[i])
s_list.sort()
s = ""
for i in range(len(s_list)):
    s += s_list[i]

t_list = []
for i in range(len(t)):
    t_list.append(t[i])
t_list.sort()
t_list.reverse()
t = ""
for i in range(len(t_list)):
    t += t_list[i]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = input()
y = input()  
 
xnew = sorted(x)
xnew = ''.join(xnew)
 
ynew = sorted(y)
ynew.reverse() 

ynew = ''.join(ynew)
 
if xnew < ynew:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = [str(input()) for i in range(2)]
A = sorted(L[0])
B = sorted(L[1])
if(A<B[::-1]):
    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))
s_sorted = sorted(s)
t_sorted = sorted(t,reverse=True)

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

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
S.sort(reverse=False)
T.sort(reverse=True)
S_sort = "".join(S)
T_sort = "".join(T)

if (S_sort < T_sort):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#082 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:
# -*- coding: utf-8 -*-

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	s=list(io())
	s.sort()
	t=list(io())
	t.sort(reverse = True)
	return 'Yes' if s < t else 'No'

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Submission status: Accepted

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

Submission status: Accepted

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