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: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[58]:


s = input()
t = input()


# In[59]:


s_list = [[w,0] for w in s]
t_list = [[w,1] for w in t]
mylist = sorted(s_list+t_list, key=lambda x: x[1], reverse=True)
mylist = sorted(mylist, key=lambda x: x[0])
for i in range(len(t)):
    if mylist[i][1] != 1:
        print("Yes")
        break
else:
    print("No")


# In[ ]:

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

n=len(s)
m=len(t)
num=min(n,m)

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


if n<m and s==t[:n]:
    print("Yes")
    
elif s==t:
    print("No")
    
else:
    for i in range(num):
        if s[i]<t[i]:
            print("Yes")
            break
            
        elif s[i]>t[i]:
            print("No")
            break

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

a = s()
t = s()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
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 S(): return input()
def LS(): return input().split()


s = list(S())
t = list(S())
# s' はなるべく辞書順で前に来るように， t' はなるべくあとに来るように並び替えて比べる
ns = ''.join(sorted(s))
nt = ''.join(sorted(t)[::-1])
print(ns, nt)
if ns < nt:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
print("Yes" if sorted(input())<sorted(input()) else "No")

Submission status: Wrong Answer

Solution code:
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)
for i in range(min(len(s),len(t))):
  if ord(s[i])<ord(t[i]):
    print("YES")
    break
  elif ord(s[i])>ord(t[i]):
    print("NO")
    break
else:
  if len(s)>=len(t):
     print("NO")   
  else:
     print("Yes")

Submission status: Wrong Answer

Solution code:
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)
for i in range(min(len(s),len(t))):
  if ord(s[i])<ord(t[i]):
    print("YES")
    break
  elif ord(s[i])>ord(t[i]):
    print("NO")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s,t=list(input()),list(input())
s.sort();t.sort(reverse=True)
l=[''.join(s),''.join(t)]
r=sorted(l)
print('Yes' if l==r else 'No')

Submission status: Wrong Answer

Solution code:
aa, bb = open(0).read().splitlines()

aa = sorted(aa)

bb = sorted(bb, reverse=True)

for a, b in zip(aa, bb):
    if a == b:
        continue
    else:
        if a<b:
            print('Yes')
        else:
            print('No')
        break
if len(aa)<len(bb):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def calculate(s, t):
    a = sorted(s,reverse=True)
    b = sorted(t,reverse=True)

    m = "".join(a)
    k = "".join(b)

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


# s = 'yx'
# t = 'axy'
#
# s = 'ratcode'
# t = 'atlas'
#
# s = 'cd'
# t = 'abc'
#
# s = 'w'
# t = 'ww'

s = input()
t = input()
calculate(s, t)

Submission status: Wrong Answer

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

if len(s) < len(t):
    for i in s:
        if not i in t:
            print('No')
            sys.exit()
#    print('Yes')
#else:
list(s).sort()
list(t).sort(reverse=True)
print(s)
print(t)
for i, j in zip(s, t):
    if ord(i) < ord(j):
        print('Yes')
        sys.exit()
print('No')

Submission status: Wrong Answer

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

if s==t:
    print("No")
else:
    flg=True
    for a in s:
        if not(a in t):
            flg=False
            break
    if flg:
        print("Yes")
    else:
        flg=False
        for a in s:
            for b in t:
                if ord(a)<ord(b):
                    flg=True
                    break
            if flg:
                break
        if flg:
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

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

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

print('No')

Submission status: Wrong Answer

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

if len(s) < len(t):
    for i in s:
        if not i in t:
            print('No')
            sys.exit()
    print('Yes')
else:
    list(s).sort()
    list(t).sort(reverse=True)
    for i, j in zip(s, t):
        if ord(i) < ord(j):
            print('Yes')
            sys.exit()
    print('No')

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ans1 = [0]*26
ans2 = [0]*26
for i in s:
    ans1[ord(i)-97] += 1
for i in t:
    ans2[ord(i)-97] += 1
for i in range(1,27):
    if ans2[-i] > ans1[-i]:
        print("Yes")
        exit()
    elif ans2[-i] < ans1[-i]:
        print("No")
        exit()
    elif i == 26 and ans2[0] == ans1[0]:
        print("No")
        exit()
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ans1 = [0]*26
ans2 = [0]*26
for i in s:
    ans1[ord(i)-97] += 1
for i in t:
    ans2[ord(i)-97] += 1

#print(ans1)
#print(ans2)

for i in range(1,27):
    if ans2[-i] < ans1[-i]:
        print("No")
        exit()
    elif ans2[-i] > ans1[-i]:
        print("No")
        exit()
    elif i == 26 and ans1[0] == ans2[0]:
        print("No")
        exit()
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ans1 = [0]*26
ans2 = [0]*26
for i in s:
    ans1[ord(i)-97] += 1
for i in t:
    ans2[ord(i)-97] += 1

#print(ans1)
#print(ans2)

for i in range(1,27):
    if ans2[-i] < ans1[-i]:
        print("No")
        exit()
    elif ans2[-i] > ans1[-i]:
        print("Yes")
        exit()
    elif i == 26 and ans1[0] == ans2[0]:
        print("No")
        exit()
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ans1 = [0]*26
ans2 = [0]*26
for i in s:
    ans1[ord(i)-97] += 1
for i in t:
    ans2[ord(i)-97] += 1

#print(ans1)
#print(ans2)

for i in range(1,27):
    if ans2[-i] < ans1[-i]:
        print("No")
        exit()
    elif ans2[-i] > ans1[-i]:
        print("Yes")
        exit()
    elif i == 26 and ans1[0] == ans2[0]:
        print("No")
        exit()
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ans1 = [0]*26
ans2 = [0]*26
for i in s:
    ans1[ord(i)-97] += 1
for i in t:
    ans2[ord(i)-97] += 1

#print(ans1)
#print(ans2)

for i in range(1,27):
    if ans2[-i] < ans1[-i] or s == t:
        print("No")
        exit()
    elif ans2[-i] > ans1[-i]:
        print("Yes")
        exit()
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
S = [ord(i) for i in input()]
T = [ord(j) for j in input()]
S.sort()
T = sorted(T, reverse=True)
#print(S,T)
for k in range(len(S)):
  try:
      if S[k] > T[k]:
        print("No")
        sys.exit()
      elif S[k] < T[k]:
        print("Yes")
        sys.exit()
      else:
        None
  except:
    print("No")
    sys.exit()
if len(S) < len(T):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    a = input()
    b = input()
    asort=''.join(sorted(a))
    bsort=''.join(sorted(b))

    if asort >bsort:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
s = list(input())
t = list(input())
s.sort()
t.sort()
for x, y in zip(s, t[::-1]):
    if x > y:
        print('No')
        sys.exit()
    elif x == y:
        continue
    else:
        print('Yes')
        sys.exit()
if len(s) <= len(t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#ABC082-B
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 s[i] < t[i]:
        print('Yes')
        break
    elif s[i] == t[i]:
        if len(s) < len(t):
            print('Yes')
            break
        else:
            print('No')
            break
    else:
        print('No')
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
lst = []
s = sorted(list(input()))
lst.append(s)
t = sorted(list(input()),reverse=True)
lst.append(t)
lst.sort()
if lst[0] == s:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

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

l = [s,t]
l.sort()
if l[0] == s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
mins = 1000
maxt = 0
for i in range(len(s)):
    mins = min(mins,ord(s[i]))
for i in range(len(t)):
    maxt = max(maxt,ord(t[i]))
if mins < maxt: print('Yes')
elif mins == maxt:
    if len(s) >= len(t): print('No')
    else: print('Yes')
else: print('No')

Submission status: Wrong Answer

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

aa = list(a)
bb = list(b)

aa.sort()
bb.sort(reverse=True)


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

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

Submission status: Wrong Answer

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

aa = list(a)
bb = list(b)

aa.sort()
bb.sort()

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

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

Submission status: Wrong Answer

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

ss = sorted(s)
tt = sorted(t)

sl = len(ss)
tl = len(tt)

ttr = list(reversed(tt))

if sl > tl:
    for i in range(tl):
        if ss[i] < ttr[i]:
            print("Yes")
            exit()
        elif ss[i] > ttr[i]:
            print("No")
            exit()
    print("No")
    exit()
    
elif sl <= tl:
    for i in range(sl):
        if ss[i] < ttr[i]:
            print("Yes")
            exit()
        elif ss[i] > ttr [i]:
            print("No")
            exit()
    print("Yes")
    exit()

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
for i in range(min(len(s),len(t))):
  if s[-1*(i+1)]==t[-1*(i+1)]:
    x=1
    continue
  elif ord(s[-1*(i+1)])>ord(t[-1*(i+1)]):
    print('No')
    x=0
    break
  else:
    x=0
    print('Yes')
    break
if x==1:
  if len(s)<len(t):
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
frag=""
n=min(len(s),len(t))
for i in range(n):
  if min(s)<min(t):
    frag="Yes"
    break
  elif min(s)>min(t):
    frag="No"
    break
  else:
    s.pop(s.index(min(s)))
    t.pop(t.index(min(t)))
if frag=="":
  if len(s)>=0:
    frag="No"
  else:
    frag='Yes'

print(frag)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
frag=""
n=min(len(s),len(t))
for i in range(n):
  if min(s)<min(t):
    frag="Yes"
    break
  elif min(s)>min(t):
    frag="No"
    break
  else:
    s.pop(s.index(min(s)))
    t.pop(t.index(min(t)))
if frag=="":
  if len(t)>0:
    frag="Yes"
  else:
    frag='No'

print(frag)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
frag="No"
n=min(len(s),len(t))
for i in range(n):
  if min(s)<min(t):
    frag="Yes"
    break
  elif min(s)>min(t):
    break
  else:
    s.pop(s.index(min(s)))
    t.pop(t.index(min(t)))

if len(t)>0:
  frag="Yes"

print(frag)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
frag="No"
n=min(len(s),len(t))
for i in range(n):
  if min(s)<min(t):
    frag="Yes"
    break
  elif min(s)>min(t):
    break
  else:
    s.pop(s.index(min(s)))
    t.pop(t.index(min(t)))

if len(t)>n:
  frag="Yes"

print(frag)

Submission status: Wrong Answer

Solution code:
import sys
R=list(input())
L=list(input())
L=sorted(L,reverse=True)
R=sorted(R,reverse=True)
N=len(L)
M=len(R)
if L==R:
  print("No")
  sys.exit()
for i in range(N):
  if i>=M:
    print("Yes")
    sys.exit()
  if L[i]>R[i]:
    print("Yes")
    sys.exit()
  elif L[i]<R[i]:
    print("No")
    sys.exit()

Submission status: Wrong Answer

Solution code:
R=list(input())
L=list(input())
L=sorted(L,reverse=True)
R=sorted(R,reverse=True)
L="".join(L)
R="".join(R)
if L>R:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if len(s) < len(t):
  len = len(s)
  flg_s=1
else:
  len = len(t)
  flg_s=0
for i in range(len):
  if ord(s[i]) < ord(t[i]):
    print('YES')
    exit(0)
  elif ord(s[i]) > ord(t[i]):
    print('NO')
    exit(0)
if flg_s == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
strs="".join(s)
strt="".join(t)
list1=[strs,strt]
str1=list1[0]
list1.sort()
if str1==list1[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
s = sorted(input())[:2]
t = sorted(input(),reverse=True)[:2]
flag = -1
i = 0



while(i < min(len(s),len(t))):
  if s[i] > t[i]:
    flag = -1
    break
  elif s[i] < t[i]:
    flag = 1
    break
  else:
    if (i+1 == len(s)) & (len(s) != len(t)):
      flag = 1
      break
    i += 1

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

Submission status: Wrong Answer

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



while(i < min(len(s),len(t))):
  if s[i] > t[i]:
    flag = -1
    break
  elif s[i] < t[i]:
    flag = 1
    break
  else:
    if (len(s) == 1) & (len(t) != 1):
      flag = 1
      break
    i += 1

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

Submission status: Wrong Answer

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



while(i < min(len(s),len(t))):
  if s[i] > t[i]:
    flag = -1
    break
  elif s[i] < t[i]:
    flag = 1
    break
  else:
    if (len(s) == 1):
      flag = 1
      break
    i += 1

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

Submission status: Wrong Answer

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



while(i < min(len(s),len(t))):
  if s[i] > t[i]:
    flag = -1
    break
  elif s[i] < t[i]:
    flag = 1
    break
  else:
    if len(s[i]) == 1:
      flag = 1
      break
    i += 1

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

Submission status: Wrong Answer

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



while(i < min(len(s),len(t))):
  if s[i] > t[i]:
    flag = -1
    break
  elif s[i] < t[i]:
    flag = 1
    break
  else:
    i += 1

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

Submission status: Wrong Answer

Solution code:
alpha = list('abcdefghijklmnopqrstuvwxyz')
s = list(input())
t = list(input())

s_index = []
t_index = []
for i in s:
  s_index.append(alpha.index(i))
for i in t:
  t_index.append(alpha.index(i))
  
if min(s_index)<max(t_index):
  print('Yes')
elif min(s_index)>max(t_index):
  print('No')
else:
  if len(s_index)<len(t_index):
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

Solution code:
alpha = list('abcdefghijklmnopqrstuvwxyz')
s = list(input())
t = list(input())

s_index = []
t_index = []
for i in s:
  s_index.append(alpha.index(i))
for i in t:
  t_index.append(alpha.index(i))
  
if min(s_index)<max(t_index):
  print('Yes')
elif min(s_index)>max(t_index):
  print('No')
else:
  if len(s_index)<len(t_index):
    print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

s,t = open(0).read().split()
ss = set(s)
st = set(t)
ls = [ord(x) for x in ss]
lt = [ord(x) for x in st]
cs = Counter([ord(x) for x in s])
ct = Counter([ord(x) for x in t])
if len(ls) == 1 and len(lt) == 1 and ls[0] == lt[0]:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')
else:
    if min(ls) >= max(lt):
        if cs[min(ls)] < ct[max(lt)]:
            print('Yes')
        elif cs[min(ls)] == ct[max(lt)]:
            if len(ls) == 1:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

s,t = open(0).read().split()
ss = set(s)
st = set(t)
ls = [ord(x) for x in ss]
lt = [ord(x) for x in st]
cs = Counter([ord(x) for x in s])
ct = Counter([ord(x) for x in t])
if len(ls) == 1 and len(lt) == 1 and ls[0] == lt[0]:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')
else:
    if min(ls) >= max(lt):
        if cs[min(ls)] < ct[max(lt)]:
            print('Yes')
        elif cs[min(ls)] == ct[max(lt)]:
            if len(s) < len(t):
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

s,t = open(0).read().split()
ss = set(s)
st = set(t)
ls = [ord(x) for x in ss]
lt = [ord(x) for x in st]
cs = Counter([ord(x) for x in s])
ct = Counter([ord(x) for x in t])
if len(ls) == 1 and len(lt) == 1 and ls[0] == lt[0]:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')
else:
    if min(ls) >= max(lt):
        if cs[min(ls)] < ct[max(lt)]:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

s,t = open(0).read().split()
ss = set(s)
st = set(t)
ls = [ord(x) for x in ss]
lt = [ord(x) for x in st]
cs = Counter([ord(x) for x in s])
ct = Counter([ord(x) for x in t])
if len(ls) == 1 and len(lt) == 1:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')
else:
    if min(ls) >= max(lt):
        if cs[min(ls)] < ct[max(lt)]:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
s,t = open(0).read().split()
ss = set(s)
st = set(t)
ls = [ord(x) for x in ss]
lt = [ord(x) for x in st]
if len(ls) == len(lt):
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')
else:
    if min(ls) >= max(lt):
        print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

s = input()
t = input()

if s < t:
	print("Yes")
	exit()
tmp = sorted(s)[0] #sの最小の文字

for x in t: #tにおける全ての文字がsの最小文字より大きいか。
	if tmp < x:
		print("Yes")
else:
	print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

d = [s1, t1]
d = sorted(d)
if d[0] == s1:
    print("Yes")
elif s1 == t1:
    print("No")
else:
    print("No")

Submission status: Wrong Answer

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

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

d = [s1, t1]
d = sorted(d)
if d[0] == s1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = sorted(input(), reverse=True)
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
ans = 'No'
k = [aa, bb]
sorted(k)
if aa != bb and k[0] == bb:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = sorted(input(), reverse=True)
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
ans = 'No'
k = [aa, bb]
sorted(k)
if k[0] == bb:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = sorted(input(), reverse=True)
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
k = sorted([aa, bb])
if k[0] == aa:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

if S < T:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import sys

s=input()
t=input()

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

alpha2num = lambda c: ord(c) - ord('A') + 1

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

s_list=[alpha2num(i) for i in s_list]
t_list=[alpha2num(i) for i in t_list]

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

#print(s_list)#昇順
#print(t_list)#降順

for i in range(min(len(s_list),len(t_list) )):
  if s_list[i]<t_list[i]: #sを早くしたい
    print("Yes")
    sys.exit()

if s_list[:min(len(s_list),len(t_list) )]<=t_list[:min(len(s_list),len(t_list) )]:
  print("Yes")
  sys.exit()
    
    
print("No")

Submission status: Wrong Answer

Solution code:
import sys

s=input()
t=input()

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

alpha2num = lambda c: ord(c) - ord('A') + 1

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

s_list=[alpha2num(i) for i in s_list]
t_list=[alpha2num(i) for i in t_list]

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

#print(s_list)#昇順
#print(t_list)#降順

cnt=0
for i in range(min(len(s_list),len(t_list) )):
  cnt+=1
  if s_list[i]<t_list[i]: #sを早くしたい
    print("Yes")
    sys.exit()
if cnt==min(len(s_list),len(t_list)):
  print("Yes")
  sys.exit()
  
print("No")

Submission status: Wrong Answer

Solution code:
input = [str(input()) for i in range(2)]
s_list = sorted(input[0])
t_list = sorted(input[1], reverse=True)

def main():
    # tが小さければno
    for s, t in zip(s_list, t_list):
        if s < t:
            return 'Yes'
        elif s > t:
            return 'No'

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

print(main())

Submission status: Wrong Answer

Solution code:
input = [str(input()) for i in range(2)]
s_list = sorted(input[0])
t_list = sorted(input[1], reverse=True)

def main():
    for s, t in zip(s_list, t_list):
        if s < t:
            return 'yes'
        elif s > t:
            return 'no'

    if len(s) >= len(t):
        return 'no'
    else:
        return 'yes'

print(main())

Submission status: Wrong Answer

Solution code:
n = input()
m = input()

n = sorted(n)
m = sorted(m, reverse = True)

flag = True

if len(n) < len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
elif len(n) == len(m):
    for i in range(len(n)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
else:
    for i in range(len(m)):
        if n[i] == m[i]:
            continue
        else:
            for j in "abcdefghijklmnopqrstuvwxyz":
                if n[i] == j:
                    flag = True
                    break
                if m[i] == j:
                    flag = False
                    break
            break
    else:
        flag = False
        

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