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()
s = "".join(s)

t.sort()
t = "".join(t)

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

s = list(str(input()))
t = str(input())

s.sort()

s = "".join(s)

ans = sorted([s, t])

if ans[0] == t:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

def sort(S):
   l = []
   for i in range(len(S)):
      l.append(S[i])
   l.sort(reverse=True)
   result = ''
   for i in range(len(l)):
      result += l[i]
   return result

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

Submission status: Wrong Answer

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

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

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

for i in range(U):
    if S[i] < T[i]:
        print("Yes")
        break
    elif S[i] == T[i]:
        continue
    else:
        print("No")
        break
    
if len(S) < len(T):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = sorted(list(input()),reverse=True)
m = sorted(list(input()),reverse=True)
if n<m:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = sorted(input())
m = sorted(input())
if n<m:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = sorted(input())
m = sorted(input())
if n<m:
    print('yes')
else:
    print('no')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
S=sorted(input())
T=sorted(input())
for i in range(min(len(S),len(T))):
  if S[i] < T[-1*(i+1)]:
    print("Yes")
    break
  elif S[i] == T[-1*(i+1)]:
    if i == min(len(S),len(T)) and len(S) < len(T):
      print("Yes")
      break
    
  else:
    print("No")
    break
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S=sorted(input())
T=sorted(input())
for i in range(min(len(S),len(T))):
  if S[i] < T[-1*(i+1)]:
    print("Yes")
    break
  elif S[i] == T[-1*(i+1)]:
    if len(S) < len(T):
      print("Yes")
      break
    
  else:
    print("No")
    break
else:
  print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

s = input()
t = input()

AL = "abcdefghijklmnopqrstuvwxyz"
S = defaultdict(int)
T = defaultdict(int)

for al in s:
  S[al] += 1

for al in t:
  T[al] += 1

ans_s = ""
for al in AL:
  ans_s += al*S[al]

ans_t = ""
for al in reversed(list(al)):
  ans_t += al*T[al]

if ans_s < ans_t:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = sorted(input(), reverse = True)
t = sorted(input(), reverse = True)
larger = len(s) if len(s) > len(t) else len(t)
try:
    for i in range(larger):
        if s[i] > t[i]:
            print('No')
            break
        elif s[i] < t[i]:
            print('Yes')
            break
    else:
        print('No')
except:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(input(), reverse = True)
t = sorted(input(), reverse = True)
larger = len(s) if len(s) > len(t) else len(t)
try:
    for i in range(larger):
        if s[i] > t[i]:
            print('No')
            break
    else:
        print('Yes')
except:
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#82B
s=sorted(list(input()))
t=sorted(list(input()))
if s<t:
    print('Yes')

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c=[]
d=[]
e=""
f=""
for i in range(len(a)):
  c.append(a[i])
for i in range(len(b)):
  d.append(b[i])
c.sort()
d.sort()
for i in range(len(a)):
  e=e+c[i]
for i in range(len(b)):
  f=f+d[-i]
if e<f:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c=[]
d=[]
e=""
f=""
for i in range(len(a)):
  c.append(a[i])
for i in range(len(b)):
  d.append(b[i])
c.sort()
d.reverse()
for i in range(len(a)):
  e=e+c[i]
for i in range(len(b)):
  f=f+d[i]
if e<f:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  S=input()
  T=input()
  if S==T:
    print("No")
  if S in T:
    print("Yes")
    return
  s=list(S)
  t=list(T)
  
  s.sort()
  t.sort(reverse=True)
  if s==t:
    print("No")
    return
  
#  if(len(s)<len(t)):
#    print("Yes")
#    return
  for i in range(min(len(s),len(t))):
    if ord(s[i])>ord(t[i]):
      print("No")
      return
    elif ord(s[i])<ord(t[i]):
      print("Yes")
      return
  print("No")
  return
main()

Submission status: Wrong Answer

Solution code:
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  S=input()
  T=input()
  if S in T:
    print("Yes")
    return
  s=list(S)
  t=list(T)
  
  s.sort()
  t.sort(reverse=True)
  if s==t:
    print("No")
    return
  if s in t:
    print("Yes")
    return
  
#  if(len(s)<len(t)):
#    print("Yes")
#    return
  for i in range(min(len(s),len(t))):
    if ord(s[i])>ord(t[i]):
      print("No")
      return
    elif ord(s[i])<ord(t[i]):
      print("Yes")
      return
  print("No")
  return
main()

Submission status: Wrong Answer

Solution code:
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  s=list(input())
  t=list(input())
  
  s.sort()
  t.sort(reverse=True)
  if s==t:
    print("No")
    return
  if s in t:
    print("Yes")
    return
  
#  if(len(s)<len(t)):
#    print("Yes")
#    return
  for i in range(min(len(s),len(t))):
    if ord(s[i])>ord(t[i]):
      print("No")
      return
    elif ord(s[i])<ord(t[i]):
      print("Yes")
      return
  print("No")
  return
main()

Submission status: Wrong Answer

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

s_d = ''.join(sorted(s,reverse=True))
t_d = ''.join(sorted(t,reverse=True))

arr = [t_d,s_d]
arr=sorted(arr)

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

if arr[0]==s_d:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
sl = []
tl = []
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
  for j in range(26):
    if(s[i]==alp[j]):
      sl.append(j)
for i in range(len(t)):
  for j in range(26):
    if(t[i]==alp[j]):
      tl.append(j)
tl.sort(reverse=True)
sl.sort()
j = 0
for i in range(min(len(sl),len(tl))):
  if(sl[i]>tl[i]):
    j += 1
if(j>0):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
sl = []
tl = []
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
  for j in range(26):
    if(s[i]==alp[j]):
      sl.append(j)
for i in range(len(t)):
  for j in range(26):
    if(t[i]==alp[j]):
      tl.append(j)
sl.sort(reverse=True)
tl.sort()
k = 0
l = 0
for i in range(len(sl)):
  k += sl[i]*(26**i)
for i in range(len(tl)):
  l += tl[i]*(26**i)
if(k>l):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
k = 28
l = -1
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
  for j in range(26):
    if(s[i]==alp[j]):
      k = min(k,j)
for i in range(len(t)):
  for j in range(26):
    if(t[i]==alp[j]):
      l = max(l,j)
if(k>l):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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


main()

Submission status: Wrong Answer

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


def main():
    s = list(input())
    t = list(input())
    com = set(s) & set(t)
    for c in com:
        s.remove(c)
        t.remove(c)
    s.sort()
    t.sort(reverse=True)
    if s < t:
        print("Yes")
    else:
        print("No")


main()

Submission status: Wrong Answer

Solution code:
# vim: fileencoding=utf-8


def main():
    s = list(input())
    t = list(input())
    s.sort()
    t.sort(reverse=True)
    if t > s:
        print("Yes")
    print("No")
    # l = len(s)
    # tl = len(t)
    # if l > tl:
    #     l = tl
    # for i in range(l):
    #     if s[i] == t[i]:
    #         continue
    #     if t[i] > s[i]:
    #         print("Yes")
    #         return
    #     print("No")
    #     return
    # if l == tl:
    #     print("No")
    #     return
    # print("Yes")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# vim: fileencoding=utf-8


def main():
    s = list(input())
    t = list(input())
    s.sort(reverse=True)
    t.sort(reverse=True)
    l = len(s)
    tl = len(t)
    if l > tl:
        l = tl
    for i in range(l):
        if s[i] == t[i]:
            continue
        if t[i] > s[i]:
            print("Yes")
            return
        print("No")
        return
    if l != tl:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# vim: fileencoding=utf-8


def main():
    s = list(input())
    t = list(input())
    s.reverse()
    t.reverse()
    l = len(s)
    tl = len(t)
    if l > tl:
        l = tl
    for i in range(l):
        if s[i] == t[i]:
            continue
        if t[i] > s[i]:
            print("Yes")
            return
        print("No")
        return
    if l != tl:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# vim: fileencoding=utf-8


def main():
    s = list(input())
    t = list(input())
    s.reverse()
    t.reverse()
    sl = len(s)
    tl = len(t)
    l = tl if sl > tl else sl
    for i in range(l):
        if s[i] == t[i]:
            continue
        if t[i] > s[i]:
            print("Yes")
            return
        print("No")
        return
    if sl < tl:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# vim: fileencoding=utf-8


def main():
    s = list(input())
    t = list(input())
    s.reverse()
    t.reverse()
    sl = len(s)
    tl = len(t)
    l = tl if sl > tl else sl
    for i in range(l):
        if s[i] == t[i]:
            continue
        if t[i] > s[i]:
            print("Yes")
            return
        print("No")
        return
    if s < t:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

answer = "Yes"
for i in range(len(s)):
  if i == len(t):
    break
  s_c = s[i]
  t_c = t[i]
  if s_c < t_c:
    break
  elif s_c == t_c:
    continue
  else:
    answer = "No"
    break

if s == t:
  answer = "No"

print(answer)

Submission status: Wrong Answer

Solution code:
# import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
enu = enumerate
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = list(input())
T = list(input())

S.sort()
T.sort(reverse=True)
for s, t in zip(S, T):
    if ord(s) < ord(t):
        print("Yes")
        exit()
else:
    if len(S) < len(T):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
# import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
enu = enumerate
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = list(input())
T = list(input())

S.sort()
T.sort(reverse=True)
for s, t in zip(S, T):
    if ord(s) < ord(t):
        print("Yes")
        exit()
else:
    print("No")

Submission status: Wrong Answer

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

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

s_sorted = sorted(s_list)
t_sorted = sorted(t_list, reverse=True)

s_joined = ''.join(s_sorted) 
t_joined = ''.join(t_sorted) 

print("{}".format(s_joined))
print("{}".format(t_joined))

if s_joined < t_joined:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

s_sorted = sorted(s_list)
t_sorted = sorted(t_list)

s_joined = ''.join(s_sorted) 
t_joined = ''.join(t_sorted) 

if s_joined > t_joined:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

s_sorted = sorted(s_list)
t_sorted = sorted(t_list)

s_joined = ''.join(s_sorted) 
t_joined = ''.join(t_sorted) 

if s_joined < t_joined:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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 l < m:
    print('Yes')
if l >= m:
    print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(input())
t = sorted(input())
flag1 = True
flag2 = False
if len(s) < len(t):
    for i in range(len(s)):
        if s[i] != t[i]:
            flag1 = False
            break
else:
    flag1 = False
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        flag2 = True
        break
if flag1 or flag2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(input().split())
b = list(input().split())

a.sort()
b.sort(reverse=True)

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

Submission status: Wrong Answer

Solution code:
if ''.join(sorted(input())) < ''.join(reversed(input())):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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 = 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:
        flg = True
        break
        
print('Yes') if flg else print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

for i in range(len(s)):
  S=s[i]
for i in range(len(t)):
  T=t[i]
if S<=T:
  print('No')
elif S==T:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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

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

for i in range(len(s)):
  S=s[i]
for i in range(len(t)):
  T=t[i]
if S<T:
  print('No')
elif S==T:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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

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

for i in range(len(s)):
  S=s[i]
for i in range(len(t)):
  T=t[i]
if S>=T:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
ss = "".join(sorted(s))
tt = "".join(list(reversed(t)))
flag = False
if ss < tt:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
ss = sorted(s)
tt = list(reversed(t))
flag = False
if ss < tt:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s =input()
t = input()
s = sorted(s, key=str.lower)
t = sorted(s, 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: Wrong Answer

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

Submission status: Wrong Answer

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()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
if s in t:
  print("Yes")
else:
  s.sort()
  t.sort()
  if s[0] < t[-1]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
else:
  print('No')

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

u=sorted([s])
v=sorted([t])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    S = sorted(input())
    T = sorted(input(), reverse=True)
    for s, t in zip(S, T):
        if s < t:
            print("Yes")
            return
    if len(S) < len(T):
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

b =[]
if len(s) <= len(t):
    for i in range(len(s)):
        if s[i] in t:
            t.remove(s[i])
            b.append(s[i])
    for i in range(len(b)):
        s.remove(b[i])
    ans = 'No'
    if len(s) == 0:
        ans = 'Yes'
    elif len(t) == len(s) == 0:
        ans ='No'
    s.sort()
    t.sort()
    for i in range(len(s)):
        if a.index(s[i]) < a.index(t[i]):
            ans = 'Yes'
        elif a.index(s[i]) > a.index(t[(i)]):
            continue
else:
    for i in range(len(t)):
        if t[i] in s:
            s.remove(t[i])
            b.append(t[i])
    for i in range(len(b)):
        t.remove(b[i])
    ans = 'No'
    if len(t) == 0:
        ans = 'No'
    s.sort()
    t.sort()
    for i in range(len(t)):
        if a.index(s[i]) < a.index(t[i]):
            ans = 'Yes'
        elif a.index(s[i]) > a.index(t[(i)]):
            continue

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input().split()
s.sort(reverse =True)
t = input().split()
t.sort()
list1 = [s,t]
list1.sort()
if list1[0] == t:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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

# sを可能な限り辞書順で小さくする
s = sorted(s)
s = "".join(s)

# tを可能な限り辞書順で大きくする
t = sorted(t, reverse=True)
t = "".join(t)

print(s,t)

# 一文字ずつ文字コードで比較する
ans = ""
N = min(len(s),len(t))
for i in range(N):
    print(ord(s[i]), ord(t[i]))
    if ord(s[i]) == ord(t[i]):
        pass
    elif ord(s[i]) < ord(t[i]):
        ans = "Yes"
        break
    else:
        ans = "No"
        break
else: #調べた文字が全部一緒だった場合、文字列の長さで比較
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"

# 出力
print(ans)

Submission status: Wrong Answer

Solution code:
p = input()
q = input()

s = list(p)
t = list(q)

s.sort()
t.sort()

front = s[0]
rear = t.pop()

f = ord(front)
r = ord(rear)

if f < r:
    answer = True
else:
    answer = False

if answer:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = "".join(sorted(input()))
T = "".join(sorted(input()))

print("Yes" if (S < T) else "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()
s_n = ''.join(sorted(s))

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

if s_n > t_n:
  print('No')

else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
la,lb = len(a), len(b)
if a==b:    print('No')
elif (la< lb and set(a)==set(b)):
    print('Yes')
else:
    sa = sorted(a, reverse=True)
    if (sa[:lb] < sorted(b, reverse = True)):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
la,lb = len(a), len(b)
if a==b:
    print('No')
elif (la< lb and set(a)==set(b)):
    print('Yes')
else:
    if (sorted(a[:lb], reverse = True) < sorted(b, reverse = True)):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
x=sorted(list(input()))
y=sorted(list(input()),reverse=True)
a=""
b=""
for (p,q) in zip(x,y):
  a+=p
  b+=q
if a<b:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

#print(s,t)
if min(s) < max(t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
s = []
t = []
for i in S:
  s.append(int(ord(i)))
for i in T:
  t.append(int(ord(i)))

s.sort()
t.sort()
for i in range(max(len(s),len(t))):
  if i >= min(len(s),len(t)):
    break
  elif max(t) > s[i]:
    print("Yes")
    exit(0)
  elif s[i] not in t:
    break
  else:
    t.remove(s[i])
    s.remove(s[i])
    
  
if len(t) > len(s):
  for i in s:
    if i == len(s):
      print("Yes")
      exit(0)
    elif i not in t:
      print("No")
      exit(0)
    else:
      t.remove(i)
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
s = []
t = []
for i in S:
  s.append(int(ord(i)))
for i in T:
  t.append(int(ord(i)))

s.sort()
t.sort()
for i in range(max(len(s),len(t))):
  if i >= min(len(s),len(t)):
    break
  elif max(t) > s[i]:
    print("Yes")
    exit(0)
  elif s[i] not in t:
    break
  else:
    t.remove(s[i])
    s.remove(s[i])
    
  
if len(t) > len(s):
  for i in s:
    if i == len(s):
      print("Yes")
      exit(0)
    elif i not in t:
      print("No")
      exit(0)
    else:
      t.remove(i)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
s = []
t = []
for i in S:
  s.append(int(ord(i)))
for i in T:
  t.append(int(ord(i)))

s.sort()
t.sort()
for i in range(max(len(s),len(t))):
  if i >= min(len(s),len(t)):
    break
  elif max(t) > s[i]:
    print("Yes")
    exit(0)
  elif s[i] not in t:
    break
  else:
    t.remove(s[i])
    s.remove(s[i])
    
  
if len(t) > len(s):
  for i in s:
    if i == len(s):
      print("Yes")
    elif i not in t:
      print("No")
      exit(0)
    else:
      t.remove(i)
else:
  print("No")
  exit(0)
print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
s = []
t = []
for i in S:
  s.append(int(ord(i)))
for i in T:
  t.append(int(ord(i)))

s.sort(reverse = True)
t.sort(reverse = True)
for i in range(max(len(s),len(t))):
  if i >= min(len(s),len(t)):
    break
  elif t[i] > s[i]:
    print("Yes")
    exit(0)
  elif s[i] != t[i]:
    break
  
if len(t) > len(s):
  for i in s:
    if i == len(s):
      print("Yes")
    elif i not in t:
      print("No")
      exit(0)
    else:
      t.remove(i)
else:
  print("No")
  exit(0)
print("No")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

    s_list = sorted(s)
    t_list = sorted(t, reverse=True)
    S = ''.join(s_list)
    T = ''.join(t_list)
    print(S < T)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

# input
s = Counter(input())
t = Counter(input())

# check
top_s = sorted(s.keys(), reverse=True)[0]
top_t = sorted(t.keys(), reverse=True)[0]
dict_top = sorted([top_s, top_t], reverse=True)[0]

str_s = "".join(list(s.elements()))
str_t = "".join(list(t.elements()))

if (len(s) > len(t) and dict_top == top_t) or (len(s) <= len(t) and (top_s == top_t or dict_top == top_t)) and not (str_s == str_t):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter

# input
s = Counter(input())
t = Counter(input())

# check
top_s = sorted(s.keys(), reverse=True)[0]
top_t = sorted(t.keys(), reverse=True)[0]
dict_top = sorted([top_s, top_t], reverse=True)[0]

str_s = "".join(list(s.elements()))
str_t = "".join(list(t.elements()))

if (len(s) > len(t) and dict_top == top_t) or (len(s) < len(t) and (top_s == top_t or dict_top == top_t)) and not (str_s == str_t):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# In[71]:


s = input()
t = input()


# In[72]:


s_list = "".join(sorted(s))
t_list = "".join(sorted(t, reverse=True))
if sorted([s_list, t_list]) == [s_list, t_list]:
    print("Yes")
else:
    print("No")


# In[ ]:

Submission status: Wrong Answer

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

# In[60]:


s = input()
t = input()


# In[63]:


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


# In[ ]: