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:
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
from bisect import bisect, bisect_left, bisect_right

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

Submission status: Accepted

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

S=[]
T=[]
for a in s:
    S.append(a)
for a in t:
    T.append(a)
S.sort()
T.sort(reverse=True)


s2=0
t2=0
ans="No"
for i in range(min(len(S),len(T))):
    s2=s2*256+ord(S[i])
    t2=t2*256+ord(T[i])
if s2<t2 :
    ans="Yes"
elif s2==t2 :
    if len(s)<len(t) :
        ans="Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = sorted(input())
t = sorted(input(), reverse=True)
l = len(s)
m = len(t)
n = min(l,m)

for i in range(n):
    if ord(s[i]) < ord(t[i]):
        print('Yes')
        sys.exit()
    if ord(s[i]) > ord(t[i]):
        print('No')
        sys.exit()

if l < m:
    print('Yes')
if l >= m:
    print('No')

Submission status: Accepted

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

ts = [t, s]
if ts != sorted(ts):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ts = [t, s]
if ts != sorted(ts):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

st = [s, t]
if st == sorted(st) and s != t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

flg = False
for i in range(len(s)):
    if i >= len(t):
        break
    if ord(s[i]) > ord(t[i]):
        break
    if ord(s[i]) < ord(t[i]):
        flg = True
        break
    if i == len(s)-1 and i < len(t)-1:
        flg = True
        break
        
print('Yes') if flg else print('No')

Submission status: Accepted

Solution code:
print('NYoe s'[sorted(input())<sorted(input())[::-1]::2])

Submission status: Accepted

Solution code:
s,t=[sorted(input()) for _ in range(2)];print('NYoe s'[s<t[::-1]::2])

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_min = ''.join(sorted(s))
t_max = ''.join(sorted(t, reverse = True))
if s_min < t_max:
    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:
a = sorted(input())
b = sorted(input(), reverse=True)
print('Yes' if a < b else 'No')

Submission status: Accepted

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

s = ''
for i in S:
    s += i
t = ''
for i in T:
    t += i

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:
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

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




if __name__ == "__main__":
	main()

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

if len(s) >= len(t):
    for i in range(len(t)):
        if ord(s[i]) - ord('a') < ord(t[i]) - ord('a'):
            print('Yes')
            quit()
        elif ord(s[i]) - ord('a') > ord(t[i]) - ord('a'):
            print('No')
            quit()
    else:
        print('No')
        quit()
else:
    for i in range(len(s)):
        if ord(s[i]) - ord('a') < ord(t[i]) - ord('a'):
            print('Yes')
            quit()
        elif ord(s[i]) - ord('a') > ord(t[i]) - ord('a'):
            print('No')
            quit()
    else:
        print('Yes')
        quit()

Submission status: Accepted

Solution code:
#
# abc082 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """yx
axy"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """ratcode
atlas"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """cd
abc"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """w
ww"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """zzz
zzz"""
        output = """No"""
        self.assertIO(input, output)


def resolve():
    s = input()
    t = input()
    S = sorted(s)
    T = sorted(t, reverse=True)

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


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s =input()
t = input()
s = sorted(s, key=str.lower)
t = sorted(t, key=str.lower, reverse=True)
s = ''.join(s)
t = ''.join(t)
l = [s,t]
l.sort()
if l[0] == s and 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:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
s = input()
t = input()
_s = "".join(sorted(s))
_t = "".join(sorted(t)[::-1])

if _s < _t:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
s = sorted(list(input()))
t = 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(s)
s_.sort()
s_ = ''.join(s_)

t_ = list(t)
t_.sort(reverse= True)
t_ = ''.join(t_)

if s_ == t_:
    print('No')
    exit()

L = [(s_, 0), (t_, 1)]
L.sort()
#print(L)
if L[0][1] == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def check():
  S = list(input())
  T = list(input())
  S.sort()
  T.sort(reverse=True)
  if S>=T:
    return 'No'
  return 'Yes'
print(check())

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 = "".join(sorted(list(input())))
T = "".join(sorted(list(input()), reverse=True))
print("Yes") if S < T else print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = ["".join(sorted(input()))]
x.append("".join(sorted(input())[::-1]))
s = x[0]
x.sort()
if x[0]==x[1]:
    print("No")
    exit()
print("Yes" if s == x[0] else "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:
s = [x for x in input()]
t = [x for x in input()]
s = sorted(s)
t = sorted(t,reverse=True)
s = "".join(s)
t = "".join(t)
print("Yes" if s<t else "No")

Submission status: Accepted

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

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

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)
for i in range(min(len(s),len(t))):
  if ord(s[i])==ord(t[i]):
    continue
  elif ord(s[i])<ord(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:
s = str(input())
t = str(input())
s_dic = {}
for i in range(len(s)):
    s_dic.setdefault(s[i],0)
    s_dic[s[i]] += 1
sort_s = sorted(s_dic.items())
#print(sort_s)
t_dic = {}
for i in range(len(t)):
    t_dic.setdefault(t[i],0)
    t_dic[t[i]] += 1
sort_t = sorted(t_dic.items())
#print(sort_t)
mk_s = ''
for i in range(len(sort_s)):
    for j in range(sort_s[i][1]):
        mk_s += sort_s[i][0]
#print(mk_s)
mk_t = ''
for i in range(len(sort_t)):
    for j in range(sort_t[-(i+1)][1]):
        mk_t += sort_t[-(i+1)][0]
#print(mk_t)

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

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

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

Submission status: Accepted

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

s_ord = sorted(list(map(ord, s)))
t_ord = sorted(list(map(ord, t)), reverse=True)

for i in range(min([len(s_ord), len(t_ord)])):
    if t_ord[i] > s_ord[i]:
        print("Yes")
        break
else:
    if len(s_ord) < len(t_ord) and s_ord == t_ord[:len(s_ord)]:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
s, t = list(input() for i in range(2))
print("Yes" if sorted(s) < sorted(t)[::-1] else "No")

Submission status: Accepted

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

	s_ascend = "".join(sorted(s))
	t_descend = "".join(sorted(t, reverse = True))

	if s_ascend < t_descend:
		print("Yes")
	else:
		print("No")



  
if __name__ == "__main__":
  	main()

Submission status: Accepted

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

news=''.join(sorted(s))
newt=''.join(sorted(t, reverse=True))
mylist=[news,newt]
mylist=sorted(mylist)

if news==newt:
    print("No")
    exit()

if mylist[0]==news:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

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)
s1 = ''.join(s)
t1 = ''.join(t)
ls = [s1,t1]
ls1 = sorted(ls)
if s1 == t1:
    print('No')
elif ls == ls1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
t=input()
s_array=[]
t_array=[]
for i in range(len(s)):
  s_array.append(s[i])
for i in range(len(t)):
  t_array.append(t[i]) 
s_array=sorted(s_array)
 
t_array=sorted(t_array,reverse=True)
for i in range(min([len(s_array),len(t_array)])):
  if s_array[i]<t_array[i]:
    print('Yes')
    exit()
  elif s_array[i]>t_array[i]:
    print('No')
    exit()
if len(s_array)<len(t_array):
  print('Yes')
  exit()
print('No')

Submission status: Accepted

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

s_dash="".join(sorted(s))
t_dash="".join(list(reversed(sorted(t))))

if s_dash < t_dash:
  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 ord(s[i]) < ord(t[i]):
        print("Yes")
        exit()
    elif ord(s[i]) > ord(t[i]):
        print("No")
        exit()
print("Yes" if len(s) < len(t) else "No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

A = sorted(a)
B = sorted(b)
B.reverse()

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

Submission status: Accepted

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

if (len(s) < len(t)) and (s == t[:len(s)]):
    print("Yes")
else:
    s = sorted(list(s))
    t = sorted(list(t))

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

Submission status: Accepted

Solution code:
S=list(input())
T=list(input())
S=sorted(S)
s="".join(S)
T=sorted(T,reverse=True)
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)
print("Yes") if s < t 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:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = ''.join(sorted(S()))
t = ''.join((sorted(S(), reverse=True)))
if s < t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
from string import ascii_lowercase as alph
from itertools import zip_longest

s,t=[list(l) for l in sys.stdin.read().split()]
d=dict((w,x) for w,x in zip(alph,range(26)))
d['?']=-1
s.sort(key=d.get)
t.sort(key=d.get, reverse=True)
for x,y in zip_longest(s,t,fillvalue='?'):
  if d[x]<d[y]:
      print('Yes')
      break
  elif d[x]>d[y]:
      print('No')
      break
else:
  print('No')

Submission status: Accepted

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

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

print("Yes" if u<v else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = sorted(raw_input())
b = sorted(raw_input())[::-1]
print 'Yes' if a < b else 'No'

Submission status: Accepted

Solution code:

s=list(input())
t=list(input())
s=sorted(s)
t=sorted(t)
x=s[0]
for i in range(len(s)-1):
    x=x+s[i+1]
y=t[-1]
for i in range(len(t)-1):
    y=y+t[-i-2]




l=[]
l.append(x)
l.append(y)
l=sorted(l)

if l.index(x)<l.index(y):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    s = readline().strip()
    t = readline().strip()

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

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
l_s = "".join(sorted(s))

t= input()
l_t = "".join(sorted(t, reverse=True))

if  l_s < l_t:
  print("Yes")
else :
  print("No")

Submission status: Accepted

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

s.sort()
t.sort(reverse=True)
alp = [chr(i) for i in range(97, 97+26)]

n = min(len(s), len(t))
flag = True
for i in range(n):
    if alp.index(s[i]) < alp.index(t[i]):
        print('Yes')
        flag = False
        break
    elif alp.index(s[i]) > alp.index(t[i]):
        print('No')
        flag = False
        break
    else:
        continue

if flag:
    if len(s) < len(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:
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()

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

Submission status: Accepted

Solution code:
s_lst = list(input())
t_lst = list(input())
s_lst.sort()
t_lst.sort(reverse = True)
s = ""
for ss in s_lst:
    s += ss
t = ""
for tt in t_lst:
    t += tt

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=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
diff=len(s)-len(t)
x= t if diff > 0 else s
x+=[" "]*abs(diff)

for i in range(len(s)):
  if s<t:
    print("Yes")
    exit()

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()
lis=sorted(list(s))
lit=sorted(list(t),reverse=1)
print("Yes" if "".join(lis) < "".join(lit) else "No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
s_list=sorted(s)
t_list=sorted(t)
t_list.reverse()
s2="".join(s_list)
t2="".join(t_list)
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)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

ans = ""
for x,y in zip(s,t):
    if x > y:
        ans = "No"
        break
    elif y > x:
        ans = "Yes"
        break

if ans == "":
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"

print(ans)

Submission status: Accepted

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

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

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

st = []
st.append(s)
st.append(t)
st = sorted(st)

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

Submission status: Accepted

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

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

#print(sr)
#print(tr)

if sr < tr:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-07-29 16:31:41 +0900
# LastModified: 2020-07-29 16:49:31 +0900
#


def main():
    S = sorted(input())
    T = sorted(input(), reverse=True)
    sorted_S = ""
    sorted_T = ""
    for s in S:
        sorted_S += s
    for t in T:
        sorted_T += t
    if sorted_S < sorted_T:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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 = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
S=len(s)
T=len(t)
x = set(s)
y = set(t)
n = min(S, T)


for i in range(n):
  if ord(s[i]) > ord(t[i]):
    print('No')
    exit()
  elif ord(s[i]) < ord(t[i]):
    print('Yes')
    exit()
    
if x==y:
  if S<T:
    print('Yes')
    exit()
  else:
    print('No')
    exit()

Submission status: Accepted

Solution code:
# ABC082 B - Two Anagrams

s=list(str(input()))
t=list(str(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,T = (input() for T in range(2))
ReS = ''.join(sorted(S))
ReT = ''.join(sorted(T)[::-1])
if ReS<ReT:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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

    if sl < st:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

# print(s)
# print(t)

s_list = list(s)
t_list = list(t)
# print(s_list)
# print(t_list)    

s_list_sorted = sorted(s_list)
t_list_sorted = sorted(t_list, reverse=True)
# print(s_list_sorted)
# print(t_list_sorted)

s_sorted = ''.join(s_list_sorted)
t_sorted = ''.join(t_list_sorted)
# print(s_sorted)
# print(t_sorted)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    s = L()
    t = L()
    s.sort()
    t.sort(reverse = True)
    print("Yes" if s < t else "No")

Submission status: Accepted

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

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

if t > s :
  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 = input()
t = input()

s_char = [x for x in s]
t_char = [x for x in t]

s_char.sort()
t_char.sort(reverse=True)

new_s = ''
new_t = ''

for x in s_char:
    new_s += x

for x in t_char:
    new_t += x

print('Yes' if new_s < new_t else 'No')

Submission status: Accepted

Solution code:
s = input()
t = input()
List=[]
ListS= list(s)
ListT = list(t)
ListS.sort()
ListT.sort(reverse= True)
S = ""
T = ""
for i in range(len(ListS)):
  S += ListS[i]  
for i in range(len(ListT)):
  T += ListT[i]
if S == T:
  print("No")
else:
  List.append(S)
  List.append(T)
  List.sort()
  if List[0]==S:
    print("Yes")
  else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
S, T = input(), input()
s = "".join(sorted([i for i in S]))
t = "".join(sorted([i for i in T])[::-1])
print("YNeos"[s >= t::2])

Submission status: Accepted

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


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = "No"

if "".join(sorted(S)) < "".join(sorted(T, reverse=True)):
    ans = "Yes"
    
print(ans)

Submission status: Accepted

Solution code:
s=[x for x in input()]
t=[x for x in input()]
s=sorted(s)
t=sorted(t,reverse=True)
s=''.join(s)
t=''.join(t)

ans=[]
ans.append(s)
ans.append(t)
ans.sort()

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