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

sl = len(s)
tl = len(t)

s = set(s)
t = set(t)

flag = False
for x in s:
    for y in t:
        if x < y:
            flag = True
            break
    if flag:
        break

if s == t and sl < tl:
    flag = True

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

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

Submission status: Accepted

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

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

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

    return


if __name__ == '__main__':
    main()

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:
# -*- coding: utf-8 -*-
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 = [str(x) for x in input()]
t = [str(x) for x in input()]
s = sorted(s)
t = sorted(t,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 S < T else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import numpy as np
import collections

s = input()
t = input()

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

#tt.sort(reverse=True)
if ss < tt:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
alph = ["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"]
s0, t0 = [], []
for i in range(26):
    for j in s:
        if alph[i] == j:
            s0.append(j)
    for j in t:
        if alph[25 - i] == j:
            t0.append(j)
s0 = "".join(s0)
t0 = "".join(t0)
print("Yes" if s0 < t0 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(reverse = True)

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

Submission status: Accepted

Solution code:
import collections

s = str(input())
t = str(input())
f = s + t
c = collections.Counter(f)
red = False
if len(c) == 1:
    if len(s) < len(t):
        red = True

for i in s:
    for k in t:
        if i < k:
            red = True
            break
if red:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

t.sort(reverse=True)
#print(s,t)

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

Submission status: Accepted

Solution code:
import math

a=input()
b=input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s = list(map(ord,s))
t = list(map(ord,t))
s.sort()
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = input()
#print(n)
n = ''.join(sorted(n))

m = input()
#print(m)
m = ''.join(sorted(m, reverse = True))

#print(n)
#print(m)

if n < m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

s, t = [c for c in s], [c for c in t]
s = sorted(s)
t = sorted(t, reverse=True)

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

if [s, t]==sorted([s, t]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys


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

    for i, j in zip(s, t):
        if i == j:
            continue
        else:
            if ord(i) > ord(j):
                print('No')
                sys.exit(0)
            else:
                print('Yes')
                sys.exit(0)

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,t = [sorted(list(input())) for _ in range(2)]
t.reverse()
print('Yes' if s<t else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
f1=[0]*26
f2=[0]*26
for i in s:
    f1[ord(i)-ord('a')]+=1
for i in t:
    f2[ord(i)-ord('a')]+=1
for i in range(26):
    if f1[i]:
        sm=i
        break
for i in range(25,-1,-1):
    if f2[i]:
        lg=i
        break
if sm<lg:
    print('Yes')
else:
    flag=True
    for i in range(26):
        if f1[i]>f2[i]:
            flag=False
            break
    if len(s)<len(t) and flag:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def f(s):
    sx=[s[i] for i in range(len(s))]
    sx.sort()
    return "".join(sx)
s=input()
t=input()
print("Yes" if f(s)<f(t)[::-1] else "No")

Submission status: Accepted

Solution code:
def f(s):
    sx=[0]*26
    for i in range (len(s)):
        p=ord(s[i])-ord("a")
        sx[p]+=1
    string=""
    for i in range(26):
        for _ in range(sx[i]):
            string+=chr(i+ord("a"))
    return string
s=input()
t=input()
print("Yes" if f(s)<f(t)[::-1] else "No")

Submission status: Accepted

Solution code:
import sys
import os


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

    S = sys.stdin.buffer.readline().decode().rstrip()
    T = sys.stdin.buffer.readline().decode().rstrip()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

s = input()
t = input()
if s == t:
    print('No')
    exit()
ss = sorted(s)
tt = sorted(t, reverse=True)
sss = ''.join(ss)
ttt = ''.join(tt)
if max(sss, ttt) == ttt:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

#sを可能な限り一番小さい文字列,tを可能な限り一番大きな文字列にする
s.sort()
t.sort(reverse=True)
s_ = "".join(s)
t_ = "".join(t)

if s_ < t_:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    s = list(input())
    t = list(input())

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

    index = 0
    while True:
        if index > len(s) - 1 or index > len(t) - 1:
            print('No')
            exit()
        if ord(s[index]) < ord(t[index]):
            print('Yes')
            exit()
        index += 1
        if index == min([len(s), len(t)]) and ord(s[index-1]) > ord(t[index-1]):
            print('No')
            exit()
        if index == min([len(s), len(t)]) and len(s) < len(t):
            print('Yes')
            exit()

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 = list(input())
s.sort()
t = list(input())
t.sort(reverse=True)
s_p =  "".join(s) 
t_p = "".join(t)
if s_p < t_p:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if s < n:
    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:
  ans = 'Yes'
else:
  ans = 'No'

print(ans)

Submission status: Accepted

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

s2="".join(sorted(s,reverse=False))
t2="".join(sorted(t,reverse=True))

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

Submission status: Accepted

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

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

def cmp(A, B):
    for i in range(min(len(A), len(B))):
        if A[i] < B[i]:
            return True

        elif A[i] > B[i]:
            return False

    if len(A) < len(B):
        return True

    return False



if cmp(S, T):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#途中の箇所はs>tに変更可

s=input()
t=input()

s=sorted(s)
t=sorted(t,reverse=True)
#s=xy, t=yxa

if t[0:len(s)] == s:
    if len(t)>len(s):
        print("Yes")
        exit()
    else:
        print("No")
        exit()

len_s=0
for ss in s:
    for tt in t :
        if ss==tt:
            len_s+=1
            if len_s==len(s):
                print("No")
                exit()
        elif ss < tt: 
            print("Yes")
            exit()

print("No")

Submission status: Accepted

Solution code:

s=input()
t=input()

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

if s> t:
    print("No")

elif s==t:
    print("No")

else:
    print("Yes")

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

u = ""
v = ""
for i in s:
    u += i
for j in t:
    v += j
if u < v:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
S=[]
t=input()
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("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
S=[]
t=input()
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()
for i in range(min(len(S),len(T))):
    ans=[S[i],T[i]]
    ans.sort()
    #print(ans)
    #print(S[i])
    #print(ans[0])
    if ans[0]==S[i] and ans[0]!=T[i]:
        print("Yes")
        exit()
#print(T)
#print(S)
if len(set(S))==1 and len(set(T))==1:
    if len(S)<len(T):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


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


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
# sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


# show_flg = True
show_flg = False


def factorization(n):
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


def main():
  s = S()
  t = S()
  s = ''.join(sorted([i for i in s]))
  t = ''.join(sorted([i for i in t], reverse=True))

  print(YNL[s < t])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=sorted(list(input()))
t=sorted(list(input()),reverse=1)
s1,t1='',''
for i in range(len(s)):
    s1+=s[i]
for i in range(len(t)):
    t1+=t[i]
print('Yes' if s1<t1 else 'No')

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = list(STR())
t = list(STR())
s.sort()
t.sort(reverse=True)
arr = [s, t]
arr.sort()
if arr[0] == s and s != arr[1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(input())
t = list(input())

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
ss = sorted(s)
tt = sorted(t,reverse=True)
if ss == tt:
  print('No')
else:
  sstt = [ss,tt]
  list = sorted(sstt)
  if list[0]==ss:
    print('Yes')
  else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=-True)
S = ''.join(s)
T = ''.join(t)
chk = [S,T]
if S == T:
  print('No')
  exit()
else:
  chk.sort()
  if chk[0] == S:
    print('Yes')
  else:
    print('No')

Submission status: Accepted

Solution code:
s1=input()
s2=input()
if s1 == s2:
    print('No')
    exit()
s1 = list(s1)
s1.sort()
s1 = ''.join(map(str,s1))
s2 = list(s2)
s2.sort(reverse=True)
s2 = ''.join(map(str,s2))
check = [s1,s2]
check.sort()

if check[0] == s1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
ss=sorted(s)
tt=sorted(t,reverse=True)
list=[ss,tt]
nlist=sorted(list)
if s==t:
    print('No')
else:
    if nlist[1] == tt:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))
s = "".join(sorted(list(input())))
t = "".join(sorted(list(input()), reverse=True))
if (s < t):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=sorted(input())
b=sorted(input())[::-1]
print("Yes" if a<b else "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:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    [s,t]=[str(input()) for i in range(2)]

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

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
s_dash = []
t_dash = []
s_d = ""
t_d = ""
for i in range(len(s)):
  s_dash.append(s[i])
for j in range(len(t)):
  t_dash.append(t[j])
s_dash.sort()
t_dash.sort()
t_dash.reverse()
for i in range(len(s_dash)):
  s_d += s_dash[i]
for j in range(len(t_dash)):
  t_d += t_dash[j]
if s_d<t_d:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
S=input()
T=input()
s=[str(a) for a in S]
t=[str(b) for b in T]
s.sort()
t.sort(reverse=True)
s=''.join(s)
t=''.join(t)
if s<t:
  print ("Yes")
else:
  print("No")

Submission status: Accepted

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

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

length = min(len(s), len(t))

while i <= length-1:
    if s[i] == t[i]:
        i += 1
    elif s[i] < t[i]:
        print('Yes')
        exit()
    else:
        print('No')
        exit()

print('No' if length == len(t) else 'Yes')

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    S = list(input().strip())
    T = list(input().strip())

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

    for s, t in zip(S, T):
        if ord(t) > ord(s):
            print("Yes")
            return
        if ord(s) > ord(t):
            print("No")
            return
    else:
        if len(T) > len(S):
            print("Yes")
        else:
            print("No")



if __name__ == '__main__':
    main()

Submission status: Accepted

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


S = input()
S_asc = "".join(sorted(S))

T = input()
T_dsc = "".join(sorted(T, reverse=True))

if S_asc < T_dsc:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#82B two anagrams
s=list(input())
t=list(input())
length=len(s)
len2=len(t)
for j in range(length):
    for i in range(0,length-j-1):
        if s[i]>s[i+1]:
            temp=s[i+1]
            s[i+1]=s[i]
            s[i]=temp
for j in range(len2):
    for i in range(0,len2-j-1):
        if t[i]<t[i+1]:
            temp=t[i+1]
            t[i+1]=t[i]
            t[i]=temp     
sd="".join(s)
td="".join(t)
# print(sd,td)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

ss = sorted(list(s), key=lambda x: x)
tt = sorted(list(t), key=lambda x: x)[::-1]
if "".join(ss) < "".join(tt):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

s_sort=sorted(s)
t_sort=sorted(t,reverse=True)
print('Yes' if s_sort<t_sort else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S, T = input(), input()
l1, l2 = [i for i in S], [i for i in T]
l1.sort()
l2.sort(reverse=True)
S1, T1 = "", ""
for i in range(len(l1)):
  S1 = S1[:] + l1[i]
for i in range(len(l2)):
  T1 = T1[:] + l2[i]
if S1 < T1:
  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:
# -*- coding: utf-8 -*-
s = list(str(input()))
t = list(str(input()))

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

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

Submission status: Accepted

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

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

s1=""
t1=""

for i in range(len(s)):
    s1+=s[i]
for g in range(len(t)):
    t1+=t[g]

j=[s1,t1]
jSorted=sorted(j)

if j[0]==j[1]:
    print("No")
    exit()

if j[0]==jSorted[0]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#n = int(input())
s = input()
t = input()
#a_L = list(map(int,input().split()))

s_L = list(s)
t_L = list(t)

s_L = sorted(s_L)
t_L = sorted(t_L,reverse=True)

s_L = "".join(s_L)
t_L = "".join(t_L)


if s_L < t_L:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
w_a = input()
w_b = input()

w_a = sorted(w_a)
w_b = sorted(w_b,reverse = True)

ord_a = list(map(lambda x: ord(x),w_a))
ord_b = list(map(lambda x: ord(x),w_b))

tmp = 0
for i in range(min(len(ord_a),len(ord_b))):
    if ord_a[i] < ord_b[i]:
        tmp -= 1
        break
    elif ord_a[i] > ord_b[i]:
        tmp += 1
        break

if w_a == w_b:
    print('No')
elif tmp == 1:
    print('No')
elif tmp == 0 and len(w_a) > len(w_b):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
#ABC082

s = sorted(input())
t = sorted(input())
a = s
b = sorted(t,reverse = True)

c = False

if len(s) < len(t):
    if s == t[:len(s)]:
        c = True
        
if c == False:
    for i in range(min(len(a),len(b))):
        if a[i] < b[i]:
            c = True
            break
        elif a[i] > b[i]:
            break

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