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

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

s_len = len(s)
t_len = len(t)

if(s_len < t_len):
    short = s_len
else:
    short = t_len

flag = False
for i in range(short):
    if(s[i] < t[i]):
        flag = False

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

s_ = ''
t_ = ''

for i in s:
    s_ += i
for j in t:
    t_ += j

dic = [s_, t_]
dic = sorted(dic)

if dic[0] == s_:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import re
s=re.findall(r"[a-z]",input())
t=re.findall(r"[a-z]",input())

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
chrdict = {}
for i, c in enumerate(range(97, 123)):
    chrdict[chr(c)] = i
src1 = input()
src2 = input()
dst1, dst2 = [], []
for i in range(len(src1)):
    dst1.append(chrdict[src1[i]])
for i in range(len(src2)):
    dst2.append(chrdict[src2[i]])
dst1.sort(reverse=True)
dst2.sort()
dsted1 = 0
dsted2 = 0
maximum = max([len(dst1), len(dst2)])
for i, v in enumerate(dst1, start=1):
    dsted1 += v * 26*(i+maximum - len(dst1))
for i, v in enumerate(dst2, start=1):
    dsted2 += v * 26*(i+maximum - len(dst2))
if int(dsted1) == int(dsted2):
    dst = "Yes" if len(src1) < len(src2) else "No"
else:
    dst = "Yes" if dsted1 < dsted2 else "No"
print(dst)

Submission status: Wrong Answer

Solution code:
chrdict = {}
for i, c in enumerate(range(97, 123)):
    chrdict[chr(c)] = i
src1 = input()
src2 = input()
dst1, dst2 = [], []
for i in range(len(src1)):
    dst1.append(chrdict[src1[i]])
for i in range(len(src2)):
    dst2.append(chrdict[src2[i]])
dst1.sort(reverse=True)
dst2.sort()
dsted1 = 0
dsted2 = 0
maximum = max([len(dst1), len(dst2)])
for i, v in enumerate(dst1):
    dsted1 += v * 27*(i+maximum - len(dst1))
for i, v in enumerate(dst2):
    dsted2 += v * 27*(i+maximum - len(dst2))
if int(dsted1) == int(dsted2):
    dst = "Yes" if len(src1) < len(src2) else "No"
else:
    dst = "Yes" if dsted1 < dsted2 else "No"
print(dst)

Submission status: Wrong Answer

Solution code:
import sys

s=input()
t=input()
s_list=[]
t_list=[]
for i in range(len(s)):
	s_list.append(s[i])
for j in range(len(t)):
	t_list.append(t[j])
s_list.sort()
t_list.sort()
print("Yes" if s_list[0]<t_list[-1] else "No")

Submission status: Wrong Answer

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

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

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

print(S)
print(T)

if S_str < T_str:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

s = sorted(s)
t = sorted(t,reverse = True)
l = min([len(s),len(t)])

for i in range(l):
    if (s[i] == t[i]) & (i < l-1):
        continue
    elif t[i] == sorted(s[i] + t[i])[0]:
        print("No")
        break
    elif len(s) >= len(t):
        print("No")
        break
    else:
        print("Yes")
        break

Submission status: Wrong Answer

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

s = sorted(s)
t = sorted(t)
l = min([len(s),len(t)])

for i in range(l):
    dec = sorted(s[i] + t[-(i+1)])
    if (dec[0] == t[-(i+1)]) & (dec[0] != s[i]):
        print("No")
        break
    elif (i == l-1):
        if (len(s) >= len(t)):
            print("No")
        else:
            print("Yes")

Submission status: Wrong Answer

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

s = sorted(s)
t = sorted(t)
l = min([len(s),len(t)])

for i in range(l):
    dec = sorted(s[i] + t[-(i+1)])
    if (dec[0] == t[-(i+1)]) & (dec[0] != s[i]):
        print("No")
        break
    elif (i == l-1) & (len(s) > len(t)):
        print("No")
        break
    else:
        print("Yes")
        break

Submission status: Wrong Answer

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

s = sorted(s)
t = sorted(t)
dec = sorted(s[0] + t[-1])
if dec[0] == t[-1]:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s=[]
t=[]
s_new=input()
t_new=input()
for i in range(len(s_new)):
    s.append(s_new[i])
for i in range(len(t_new)):
    t.append(t_new[i])
s_sorted=sorted(s)
t_sorted=sorted(t)
if s[len(s)-1]<t[len(t)-1]:
    print('Yes')
elif s[len(s)-1]==t[len(t)-1] and 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()
if s < t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
sl = list(s)
tl = list(t)
ss = sorted(sl)
ts_re = sorted(tl)
ts = []
for i in range(1, len(ts_re)+1):
  ts.append(ts_re[len(ts_re) - i])
alph = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
m = 0
if len(ss) <= len(ts):
  m = len(ss)
  l = 0
  for j in range(m):
    if alph.index(ss[j]) < alph.index(ts[j]):
      print("Yes")
      break
    elif alph.index(ss[j]) == alph.index(ts[j]) :
      if j == m -1:
        print("Yes")
      else:
        pass
    else:
      print("No")
      break
elif len(ss) == len(ts):
  m = len(ss)
  l = 0
  for j in range(m):
    if alph.index(ss[j]) < alph.index(ts[j]):
      print("Yes")
      break
    elif alph.index(ss[j]) == alph.index(ts[j]) :
      if j == m -1:
        print("No")
      else:
        pass
    else:
      print("No")
      break
else:
  m = len(ts)
  l = 0
  for j in range(m):
    if alph.index(ss[j]) < alph.index(ts[j]):
      print("Yes")
      break
    elif alph.index(ss[j]) == alph.index(ts[j]) :
      if j == m - 1:
        print("No")
    else:
      print("No")
      break

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
sl = list(s)
tl = list(t)
ss = sorted(sl)
ts_re = sorted(tl)
ts = []
for i in range(1, len(ts_re)+1):
  ts.append(ts_re[len(ts_re) - i])
alph = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
m = 0
if len(ss) <= len(ts):
  m = len(ss)
  l = 0
  for j in range(m):
    if alph.index(ss[j]) < alph.index(ts[j]):
      print("Yes")
      break
    elif alph.index(ss[j]) == alph.index(ts[j]) :
      if j == m -1:
        print("No")
      else:
        pass
    else:
      print("No")
      break
else:
  m = len(ts)
  l = 0
  for j in range(m):
    if alph.index(ss[j]) < alph.index(ts[j]):
      print("Yes")
      break
    elif alph.index(ss[j]) == alph.index(ts[j]) :
      if j == m - 1:
        print("No")
    else:
      print("No")
      break

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
sl = list(s)
tl = list(t)
ss = sorted(sl)
ts_re = sorted(tl)
ts = []
for i in range(1, len(ts_re)+1):
  ts.append(ts_re[len(ts_re) - i])
alph = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
m = 0
if len(ss) <= len(ts):
  m = len(ss)
  l = 0
  for j in range(m):
    if alph.index(ss[j]) < alph.index(ts[j]):
      print("Yes")
      break
    elif alph.index(ss[j]) == alph.index(ts[j]) :
      pass
    else:
      print("No")
      break
else:
  m = len(ts)
  l = 0
  for j in range(m):
    if alph.index(ss[j]) < alph.index(ts[j]):
      print("Yes")
      break
    elif alph.index(ss[j]) == alph.index(ts[j]) :
      if j == m - 1:
        print("No")
    else:
      print("No")
      break

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
S=sorted(S)
T=sorted(T, reverse=True)
if S < T:
    print(S)
    print(T)
    print("Yes")

Submission status: Wrong Answer

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

t = t[::-1]

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, t = ''.join(s), ''.join(t)

if s<t:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# s = sorted('ratcode')
# t = sorted('atlas')[::-1]


def judge(s, t):
    N = len(s)
    M = len(t)

    if s == t:
        return True

    if N < M and len(set(s).intersection(set(t))) == N:
        return True

    min_len = min(N, M)
    for a, b in zip(s[:min_len], t[:min_len]):
        if a == b:
            continue
        return a < b
    # M が小さくて途中まで同じだったら省く
    return False


if judge(s, t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

# s = sorted('ratcode')
# t = sorted('atlas')[::-1]


def judge(s, t):
    N = len(s)
    M = len(t)

    if s == t:
        return True

    if N < M and len(set(s).intersection(set(t))) == N:
        return True

    min_len = min(N, M)
    for a, b in zip(s[:min_len], t[:min_len]):
        if a == b:
            continue
        return a < b
    return True


if judge(s, t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

sorted_s = ''.join(sorted(s))
sorted_t = ''.join(sorted(t, reverse = True))

if sorted_s < sorted_t :
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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



if len(S)>=len(T):
    S.sort(reverse=True)
    T.sort()
    LEN = len(S)
    s = "".join(S)
    t = "".join(T)
    if s > t:
        print("Yes")
    else:
        print("No")
else:
    S.sort()
    T.sort(reverse=True)
    LEN = len(T)
    s = "".join(S)
    t = "".join(T)
    if s < t:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
str1 = input()
str2  = input()

if str1 == str2:
	print('No')
else:
	arr1 = [ ord(s) for s in str1 ]
	arr2 = [ ord(s) for s in str2 ]

	
	arr1.sort()
	arr2.sort(reverse=True)

	for s, t, in zip(arr1, arr2):
		if s == t:
			continue
		else:
			if t > s:
				print('Yes')
				break
			else:
				print('No')
				break

Submission status: Wrong Answer

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

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[i] < t[i]:
        print('Yes')
        exit()
    elif s[i] > t[i]:
        print('No')
        exit()
  
if s == t:
    print('No')
    exit()

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

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[i] < t[i]:
        print('Yes')
        exit()

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

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

Submission status: Wrong Answer

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

## 辞書順の判定
# 文字列を任意に並び変える：abc順が良い
s_dash = ''.join(sorted(s))
t_dash = ''.join(sorted(t))

detArray = []
for i in range(len(s_dash[0:-1]) + 1):
    if len(s_dash[0:-1]) < len(t_dash[0:-1]):
        if s_dash[i] == t_dash[i]:
            detArray.append(True)
        else:
            detArray.append(False)
for j in range(min(len(s_dash), len(t_dash))):
    for k in range(j):
        if s_dash[k] == t_dash[k] and s_dash[j] < t_dash[j]:
            detArray.append(True)
        else:
            detArray.append(False)


if all(detArray):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list((input()))
s.sort()
z = sorted((input()), reverse=True)
c = len(s) if len(s) <= len(z) else len(z)
for i in range(c):
  if s[i] > z[i]:
    print('No')
    exit()
if len(s) >= len(z):
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
s = list((input()))
s.sort()
z = sorted((input()), reverse=True)
c = len(s) if len(s) <= len(z) else len(z)
for i in range(c):
  if s[i] < z[i]:
    print('Yes')
    exit()
if s[c-1] == z[c-1] and len(s) >= len(z):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = list((input()))
s.sort()
z = sorted((input()), reverse=True)
c = len(s) if len(s) <= len(z) else len(z)
for i in range(c):
  if s[i] > z[i]:
    print('No')
    exit()
if s[-1] == z[-1] and len(s) >= len(z):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = list((input()))
s.sort()
z = sorted((input()), reverse=True)
if s[0] > z[0]:
  print('No')
elif s[-1] == z[-1] and len(s) >= len(z):
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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


if s_split < t_split:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

if len(s_split) < len(t_split):
    if s_split <= t_split:
        print("Yes")
    else:
        print("No")
else:
    if s_split < t_split:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

if len(s_split) < len(t_split):
    if s_split <= t_split:
        print("Yes")
    else:
        print("No")
else:
    if s_split < t_split:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
#coding:utf-8
S = str(input())
T = str(input())
S = "".join(sorted(S))
T = "".join(sorted(T))
S = S[::-1]
ST = sorted([S,T])
if (ST[0]==T and S!=T):
    print ("Yes")
else:
    print ("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(str(input()))
t = list(str(input()))
alp = 'abcdefghijklmnopqrstuvwxyz'
slst = []
tlst = []

for i in range(len(s)):
    slst.append(alp.find(s[i]))
for i in range(len(t)):
    tlst.append(alp.find(t[i]))

if min(slst)>max(tlst):
    print('No')
elif min(slst)==max(tlst):
    if max(slst)>min(tlst):
        print('No')
    else:
        if len(slst)<=len(tlst):
            print('No')
        else:
            print('Yes')
else:
    print('Yes')

Submission status: Wrong Answer

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

s.sort()
t.sort()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# Proglem https://atcoder.jp/contests/abc082/tasks/abc082_b
# Python 2nd Try


yes = "Yes"
no = "No"


def solver(sstr, tstr):
    result = True
    tend_str = ''.join(reversed(sorted(list(tstr))))
    if sstr < tend_str:
        result = True
    else:
        result = False
    return result


if __name__ == "__main__":
    s = input()
    t = input()
    if solver(s, t):
        print(yes)
    else:
        print(no)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
s = list(input().rstrip())
t = list(input().rstrip())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    x, y = s[i], t[i]
    if alpha2num(x) < alpha2num(y):
        print("Yes")
        sys.exit()
    elif alpha2num(x) > alpha2num(y):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    x, y = s[i], t[i]
    if alpha2num(x) < alpha2num(y):
        print("Yes")
        sys.exit()
    elif alpha2num(x) > alpha2num(y):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
N = len(S)
T = list(input())
M = len(T)
S.sort()
T.sort()
mmm = min(N, M)

for i in range(mmm):
    if S[i] > T[i]:
        print("No")
        exit()
    elif S[i] < T[i]:
        print("Yes")
        exit()
    else:
        continue

if N < M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print("Yes" if max(input())>min(input()) else "No")

Submission status: Wrong Answer

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

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

# print(s,t)
if s == [] and t == []:
    print('No')
    exit()
elif s == []:
    print('Yes')
    exit()
elif t == []:
    print('No')
    exit()
if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(s) < len(t):
    print('Yes')
    exit()
else:
    print('No')

Submission status: Wrong Answer

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

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

# print(s,t)
if s == [] and t == []:
    print('No')
    exit()
elif s == []:
    print('Yes')
elif t == []:
    print('No')

if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(s) < len(t):
    print('Yes')
    exit()
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = "".join(sorted(input()))
b = "".join(sorted(input())[::-1])
print("YES" if a < b else "NO" )

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    s_list = list(s)
    s_list.sort()

    t = input()
    t_list = list(t)
    t_list.reverse()

    for i in range(0,min(len(s_list),len(t_list))):
        if s_list[i] < t_list[i]:
            print("Yes")
            return
        elif s_list[i] > t_list[i]:
            print("No")
            return

    if len(s_list) < len(t_list):
        print("Yes")
    else:
        print("No")

    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    s_list = list(s)
    s_list.sort()

    t = input()
    t_list = list(t)
    t_list.sort()

    for i in range(0,min(len(s_list),len(t_list))):
        if s_list[i] < t_list[i]:
            print("Yes")
        else:
            print("No")
        return

    if len(s_list) < len(t_list):
        print("Yes")
    else:
        print("No")

    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():

    s = input()
    s_list = list(s)
    s_list.sort()

    t = input()
    t_list = list(t)
    t_list.sort()

    for i in range(0,min(len(s_list),len(t_list))):
        if s_list[i] < t_list[i]:
            print("Yes")
            return

    if len(s_list) < len(t_list):
        print("Yes")
    else:
        print("No")

    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    try:
        s = sorted(input())
        t = sorted(input())
        print('Yes') if s > t else print('No')
    except:#エラー
        pass

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s=input
print(s)

Submission status: Wrong Answer

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

if s<t:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N = input()
M = input()

sorted_asc = sorted(list(N))
sorted_desc = sorted(list(M), reverse=True)
res = ""

for (x, y) in zip(sorted_asc, sorted_desc):
    if x < y:
        res = "Yes"
        break
    elif x > y:
        res = "No"
        break

if res == "" and len(N) == len(M):
    res = "No"
elif res == "" and len(N) < len(M):
    res = "Yes"

print(res)

Submission status: Wrong Answer

Solution code:
N = input()
M = input()

sorted_asc = sorted(list(N))
sorted_desc = sorted(list(M), reverse=True)
res = ""

for (x, y) in zip(sorted_asc, sorted_desc):
    if x < y:
        res = "Yes"
        break
    elif x > y:
        res = "false"
        break

if res == "" and len(N) == len(M):
    res = "No"
elif res == "" and len(N) < len(M):
    res = "Yes"

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s.sort()
t.sort(reverse=True)
s=''.join(s)
t=''.join(t)
l=[s,t]
l2=[s,t]
if l==l2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()
s_asc = ''.join(sorted(s))

t = input()
t_desc = ''.join(sorted(t, reverse = True))

print(s_asc)
print(t_desc)

Submission status: Wrong Answer

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

s.sort()

#リストを逆順に並び替え
t.sort(reverse=True)

#要素を、１つの文字列にする。
s = ''.join(s)
t = ''.join(t)

print(s)
print(t)

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

Submission status: Wrong Answer

Solution code:
def examB():
    St = S(); T = S()
    Stnum = []; Tnum = []
    for s in St:
        Stnum.append(ord(s))
    for s in T:
        Tnum.append(ord(s))
    Stnum.sort(); Tnum.sort(reverse = True)
    ans = "Yes"
    for i in range(min(len(St),len(T))):
        if Stnum[i] < Tnum[i]:
            break
        elif Stnum[i]==Tnum[i]:
            continue
        else:
            ans = "No"
            break
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Wrong Answer

Solution code:
from sys import stdin


s = stdin.readline().rstrip()
s = [str(i) for i in s]

t = stdin.readline().rstrip()
t = [str(i) for i in t]

if s == t:
    print("N0")
    exit()
s.sort()
t.sort(reverse=True)

ns = ""
nt = ""

for i in range(len(s)):
    ns += s[i]

for i in range(len(t)):
    nt += t[i]

li = [ns,nt]

lin = sorted(li)


if lin == li:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
from sys import stdin

s = stdin.readline().rstrip()
s = [str(i) for i in s]

t = stdin.readline().rstrip()
t = [str(i) for i in t]

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

ns = ""
nt = ""

for i in range(len(s)):
    ns += s[i]

for i in range(len(t)):
    nt += t[i]

li = [ns,nt]

lin = sorted(li)


if lin == li:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
import sys

def main():
  s = list(input())
  t = list(input())
  
  s.sort()
  t.sort()
  m = min(len(s), len(t))
  for i in range(m):
    if s[i] == t[i]:
      pass
    elif s[i] > t[i]:
      print('No')
      sys.exit()
    elif s[i] < t[i]:
      print('Yes')
      sys.exit()
  if len(s) == len(t):
    print('No')
    sys.exit()
  if len(s) < len(t):
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()
    
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s=sorted(s)
t=sorted(t,reverse=True)
S=""
for x in s:
  S+= x
T=""
for x in t:
  T+= x
A=[S,T]
a=sorted(A)
if a[0]==S:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
s=sorted(s)
t=sorted(t,reverse=True)
S=""
for x in s:
  S+= x
T=""
for x in t:
  T+= x
A=[S,T]
a=sorted(A)
if A[0]==S:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
s_a=''.join(sorted(s))
t_z=''.join(reversed(sorted(t)))
if s_a <= t_z:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s,t=[list(input()) for i in range(2)]
s.sort()
t.reverse()
h=[]
h.append(s)
h.append(t)
h.sort()
if h[0]==s and s!=t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = sorted([i for i in input()])
m = sorted([i for i in input()],reverse = True)

flg = True
if ''.join(n) > ''.join(m):
    flg = False
elif ''.join(n) == ''.join(m):
    flg = False
elif len(n) > len(m):
    flg = False
else:
    pass

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

Submission status: Wrong Answer

Solution code:
S = sorted(list(map(str, input())))
T = sorted(list(map(str, input())), reverse = True)
length = min(len(S), len(T))

flg = 2

for i in range(length):
	if S[i] < T[i]:
		flg = 1
		break
	elif S[i] > T[i]:
		flg = 0
		break

if flg == 1:		
	print("Yes")
elif flg == 0:
	print("No")
else:
	if len(S) <= len(T):
		print("Yes")
	else:
		print("No")

Submission status: Wrong Answer

Solution code:
s = sorted(input())
t = sorted(input())
N = len(s)
M = len(t)
ans = "No"

if N < M:
  flag = True
  for i in range(N):
    if s[i] not in t:
      flag = False
  if flag:
    ans = "Yes"
else:
  for i in range(min(N, M)):
    if s[i] == t[i]:
      for j in range(i+1, min(N, M)):
        if s[j] < t[j]:
          ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.reverse()
h=[]
s="".join(s)
t="".join(t)
h.append(s)
h.append(t)
h.sort()
#print(h)
#print(s)
if h[0]==s:
    print("Yes")
elif h[0]==h[1]:
    print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.reverse()
h=[]
h.append(s)
h.append(t)
h.sort()
#print(h)
#print(s)
if h[0]==s:
    print("Yes")
elif h[0]==h[1]:
    print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
s.sort()
t.reverse()
h=[]
h.append(s)
h.append(t)
h.sort()
#print(h)
#print(s)
if h[0]==s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
"""
author : halo2halo
date : 25,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

a = readline().rstrip()
b = readline().rstrip()

sorted(a)
sorted(b)[::-1]

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
S=[]
T=[]
LIST=[]
for i in range(len(s)):
    S.append(s[i])
for j in range(len(t)):
    T.append(t[j])
S.sort()
T.sort()
apple=[]
apple.append(S)
apple.append(T)
#print(apple)
apple.sort()
#print(apple)
if apple[0]==S and apple[0]!=apple[1]:
    print("Yes")
elif apple[0]==apple[1]:
    print("No")
else:
    print("No")