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

for item in zip(s,t):
    if ord(item[0]) < ord(item[1]):
        print('Yes')
        exit()
    elif ord(item[0]) > ord(item[1]):
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    s = [item for item in input()]
    t = [item for item in input()]

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


    if rs < rt:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
s = "".join(sorted(input()))
t = "".join(sorted(input())[::-1])

if sorted([s,t])[0] == s and 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:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

s=input().rstrip()
t=input().rstrip()
u=sorted(list(s))
v=sorted(list(t),reverse=True)
#print(v)
ss=""
tt=""
for i in u:
    ss+=i
for j in v:
    tt+=j
#print(ss)
#print(tt)
if ss<tt:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

s = list(input())
t = list(input())
# ss = list(itertools.permutations(s)).sort()
# tt = list(itertools.permutations(t)).sort()
s.sort()
t.sort()
ti = t[::-1]
ss = ''.join(s)
tt = ''.join(ti)
tmp = []
tmp.append(ss)
tmp.append(tt)
tmp.sort()
if tmp[0] == ss and ss != tt:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
t=input()
s_=sorted(s)
t_=sorted(t,reverse=True)
A=[]
A.append(s_)
A.append(t_)
B=sorted(A)
if B[0]==s_ and B[0]!=B[1]:
  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("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
from collections import Counter
s = input()
t = input()
s_cnt = sorted(Counter(s).most_common())
t_cnt = sorted(Counter(t).most_common())[::-1]
s_replaced = ""
t_replaced = ""
for k, v in s_cnt:
    s_replaced += k * v 
for k, v in t_cnt:
    t_replaced += k * v 

def judge(s, t):
    for i in range(min(len(s), len(t))):
        if ord(s[i]) > ord(t[i]):
            return False
        if ord(s[i]) < ord(t[i]):
            return True
    if len(s) < len(t):
        return True
    else:
        return False

if judge(s_replaced, t_replaced):
    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)
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    s =     _in[0]   # type:str
    t =     _in[1]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    s_arr = [_s for _s in s]
    t_arr = [_t for _t in t]
    s_arr.sort()
    t_arr.sort(reverse=True)
    s = ''.join(s_arr)
    t = ''.join(t_arr)
    if s==t:
        TF = 'Yes' if len(s)<len(t) else 'No'
    else:
        TF = 'Yes' if s<t else 'No'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for ss, tt in zip(s, t):
    if ss<tt:
        print('Yes')
        break
    elif ss>tt:
        print('No')
        break
else:
    if len(s)<len(t):
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
ss=[s[x] for x in range(len(s))]
ss.sort()
t=input()
tt=[t[x] for x in range(len(t))]
tt.sort(reverse=True)
if ss<tt:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Alpha = ['0', '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']

while len(s) != len(t):
    if len(s) > len(t):
        t.append('0')
    else:
        s.append('0')

for i in range(len(s)+1):
    if i == len(s):
        print('No')
    elif Alpha.index(s[i]) < Alpha.index(t[i]):
        print('Yes')
        break
    elif Alpha.index(s[i]) > Alpha.index(t[i]):
        print('No')
        break
    else:
        continue

Submission status: Accepted

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

s1 = sorted(s)
s2 = "".join(s1)

t1 = sorted(t, reverse=True)
t2 = "".join(t1)

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

Submission status: Accepted

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

if s == t:
    print("No")
else:
    str_list = ["".join(s), "".join(t)]

    sorted_str_list = sorted(str_list)

    if str_list[0] == sorted_str_list[0]:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
s2 = ""
t2 = ""
for i in range(len(s)):
    s2+=s[i]
for i in range(len(t)):
    t2+=t[i]
dic = [s2,t2]
dic.sort() 
if s2 == t2:
    print("No")
    sys.exit()   
if dic[0] == s2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

n = min(len(s),len(t))
A = "No"
if s[0:n] == t[0:n] and len(s)<len(t):
  print("Yes")
  exit()
for i in range(n):
  if s[i] < t[i]:
    print("Yes")
    exit()
  
print(A)

Submission status: Accepted

Solution code:
A=list(input())
B=list(input())
A.sort()
B.sort(reverse=True)
C = [A,B]
C.sort()
if "".join(B) == "".join(C[1]) and A != B:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a=list(input())
b=list(input())
a.sort()
b.sort(reverse=True)

i=0
while a[i] == b[i] and i<min(len(a),len(b))-1:
    i+=1


if a[i]<b[i] or (a[i]==b[i] and len(a)<len(b)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
        flag = 1
        break

if len(s) < len(t) and s == t[:len(s)]:
    flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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)
S = [ord(s[i]) for i in range(len(s))]
T = [ord(t[i]) for i in range(len(t))]
l = 0
if len(S) < len(T):
  for i in range(len(S)):
    if S[i] < T[i]:
      print('Yes')
      break
    elif S[i] >T[i]:
      print('No')
      break
    else:
      l += 1
  if l == len(S):
    print('Yes') 
else:
  for i in range(len(T)):
    if S[i] < T[i]:
      print('Yes')
      break
    elif S[i] >T[i]:
      print('No')
      break
    else:
      l += 1
  if l == len(T):
    print('No')

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc082/tasks/abc082_b

s = [i for i in input()]
t = [i for i in input()]

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

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

ans = [(s, 0), (t, 1)]
ans.sort()
if s == t:
    print('No')
elif ans[0][1] == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
INIT_VAL = 0
def DD2(d1,d2): return [[INIT_VAL]*d2 for _ in range(d1)]
def DD3(d1,d2,d3): return [DD2(d2,d3) for _ in range(d1)]
## math ##
MOD=10**9+7
def divc(x,y): return -(-x//y)
def divf(x,y): return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers"""
    is_prime = [True] * MAX_NUM
    is_prime[0] = False
    is_prime[1] = False
    primes = []
    for i in range(MAX_NUM):
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_NUM, i):
                is_prime[j] = False
    return primes
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
    # 整数 1 つ
    n = sorted(input())
    m = sorted(input(), reverse=True)
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

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

resolve()

Submission status: Accepted

Solution code:
s = input()
t = input()
ss = sorted(s)
tt = sorted(t,reverse=True)
for n, w in zip(ss,tt):
  if n < w:
    print("Yes")
    exit()
  elif n > w:
    print("No")
    exit()
if len(ss) >= len(tt):
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

zisho = "abcdefghijklmnopqrstuvwxyz"

s_list = []
t_list = []

for i in range(len(s)):
  s_list.append(zisho.index(s[i])+1)
s_list.sort()
for i in range(len(t)):
  t_list.append(zisho.index(t[i])+1)
t_list.sort(reverse = True)

if len(s) > len(t):
  for i in range(len(s)-len(t)):
    t_list.append(0)
if len(t) > len(s):
  for i in range(len(t)-len(s)):
    s_list.append(0)

s_int = 0
t_int = 0

dif = 0

length = len(s_list)

#print(s_list)
#print(t_list)

for i in range(length):
#  s_int = s_int + 100 ** (len(s)-i-1) * s_list[i]
#  t_int = t_int + 100 ** (len(s)-i-1) * t_list[i]
  dif = dif + 100 ** (length-i-1) * t_list[i] - 100 ** (length-i-1) * s_list[i]

#if s_int < t_int: print('Yes')
#else: print('No')
#print(dif)
if dif > 0: print('Yes')
else: print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

    s_num = list()
    t_num = list()

    for ss in s:
        s_num.append(ord(ss))
    for tt in t:
        t_num.append(ord(tt))

    s_num.sort()
    t_num.sort(reverse=True)

    s_str = ''
    t_str = ''
    for ss in s_num:
        s_str += chr(ss)
    for tt in t_num:
        t_str += chr(tt)

    if s_str == t_str:
        print('No')
    elif min([s_str, t_str]) == s_str:
        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:
def main():
    s = sorted(input())
    t = sorted(input(), reverse=True)

    cond = s < t

    print('Yes' if cond else 'No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(map(str, input()))
T = list(map(str, input()))
S.sort()
T.sort()
T = T[::-1]

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(reverse=True)
ans = 'Yes'
n = min(len(s), len(t))
if s[:n] == t[:n]:
    if len(s) >= len(t):
        ans = 'No'
else:
    for sc, tc in zip(s, t):
        if sc == tc:
            continue
        if sc > tc:
            ans = 'No'
        else:
            ans = 'Yes'
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import sys

input = sys.stdin.readline

s = input()
t = input()

x = sorted(s)[1:]
y = sorted(t,reverse=True)[:len(t)-1]

#print(x[:len(x)])
#print(y[:len(x)])
if x[0] < y[0]:
    print("Yes")
    exit()
else:
    if len(x) < len(y) and (x[:len(x)] == y[:len(x)]) :
        print("Yes")
        exit()
    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 s==t:
  print("No")
  exit(0)
a=list(s)
b=list(t)
a.sort()
b.sort(reverse=True)
a="".join(a)
b="".join(b)
l=[a,b]
l.sort()
if l[0]==a:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def main():
    s = sorted(list(input()))
    t = sorted(list(input()), reverse=True)
    s = ''.join(s)
    t = ''.join(t)
    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(reverse=True)

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
s=sorted(input()[:-1])
t=sorted(input()[:-1])[::-1]
print("Yes" if s<t 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 heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
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 = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    S = sorted(input())
    T = sorted(input(), reverse=True)
    lim = min(len(S), len(T))
    for i in range(lim):
        if (S[i]) > T[i]:
            print("No")
            break
        if S[i] == T[i]:
            continue
        else:
            print("Yes")
            break
    else:
        if len(S)<len(T):
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    solve()

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= str(input())
t= str(input())

S = ['a']*len(s)
T = ['a']*len(t)

for i in range (0, len(s)):
	S[i]=ord(s[i])

for i in range (0, len(t)):
	T[i]=ord(t[i])

S = sorted(S)
T = sorted(T, reverse=True)

check = 0

for i in range (0, min(len(s), len(t))):
	if S[i] < T[i]:
		print('Yes')
		exit()
	elif S[i] == T[i]:
		check+=1

if check == min(len(S),len(t)) and len(T)>len(S):
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
s=''.join(sorted(input()))
t=''.join(sorted(input(),reverse=True))
print('YNeos'[s>=t::2])

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = list(readline().rstrip().decode())
t = list(readline().rstrip().decode())
s.sort()
t.sort(reverse=True)
for ss, tt in zip(s, t):
    if ss < tt:
        print('Yes')
        exit()
    if ss > tt:
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

if str(''.join(s))>=str(''.join(t)):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

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

if S == T:
    print ('No')
    exit()

lst = [S, T]

if lst == sorted(lst):
    print ('Yes')
else:
    print ('No')

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    *S,=ST()
    *T,=ST()
    S.sort()
    T.sort(reverse=True)
    S="".join(S)
    T="".join(T)
    print("YNeos"[S>=T::2])
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    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:
def main():
    S = input()
    T = input()
    if "".join(sorted(S)) < "".join(sorted(T, reverse=True)):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc082/tasks/abc082_b
s = input()
t = input()
# sのほうが小さくできる→sの一番小さな文字<tの一番大きい文字よりも小さくできれば良い

# ただし同一文字が存在する場合はどんどん次を見ていく
s = sorted(list(s))
t = sorted(list(t), reverse=True)

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

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())
ans = False
for i in range(len(t)):
    if s < t[i:]:
        ans = True
print("Yes" if ans 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)
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def myAnswer(s:list,t:list) -> str:
   s.sort()
   t.sort(reverse=True)
   # print(s,t)
   return "Yes" if(s < t) else "No"

def modelAnswer():
   return
def main():
   s = list(input())
   t = list(input())
   print(myAnswer(s,t))
if __name__ == '__main__':
   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:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
S = input()
T = input()
Slis = sorted(list(S))
Tlis = sorted(list(T))[::-1]
SS = "".join(Slis)
TT = "".join(Tlis)
ans = "No"
if SS<TT:
    ans = "Yes"

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = sorted(input())
T = sorted(input(), reverse=True)

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

Submission status: Accepted

Solution code:
S = input()
T = input()
S = sorted(S)
T = sorted(T, reverse=True)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
slist=list(input())
tlist=list(input())

slist.sort()
tlist.sort(reverse=True)
if slist<tlist:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s_=str()
t_=str()
for i in range(len(s)):
    s_+=s[i]
for j in range(len(t)):
    t_+=t[j]
    
dic=[s_,t_]
dic.sort()
print("Yes" if dic[0]==s_ and s!=t else "No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s_len = len(s)
t_len = len(t)
min_len = min(s_len,t_len)
s.sort()
t.sort(reverse=1)

for i in range(min_len):
    if s[i] < t[i]:
        print("Yes")
        exit()
    elif s[i] > t[i]:
        print("No")
        exit()
if s_len >= t_len:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
letters_s = []
letters_t = []
for i in range(len(s)):
  letters_s.append(s[i])
letters_s.sort()
for i in range(len(t)):
  letters_t.append(t[i])
letters_t.sort(reverse=True)
ss = "".join(letters_s)
tt = "".join(letters_t)
if ss < tt:
  print("Yes")
else:
  print("No")