Problem:


Score : 200 points

Problem Statement

You are given strings s and t, consisting of lowercase English letters.
You will create a string s' by freely rearranging the characters in s.
You will also create a string t' by freely rearranging the characters in t.
Determine whether it is possible to satisfy s' < t' for the lexicographic order.

Notes

For a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M, we say a < b for the lexicographic order if either one of the following two conditions holds true:

N < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.

There exists i (1 \leq i \leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.

For example, xy < xya and atcoder < atlas.

Constraints

The lengths of s and t are between 1 and 100 (inclusive).

s and t consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

s
t

Output

If it is possible to satisfy s' < t', print Yes; if it is not, print No.

Sample Input 1

yx
axy

Sample Output 1

Yes

We can, for example, rearrange yx into xy and axy into yxa. Then, xy < yxa.

Sample Input 2

ratcode
atlas

Sample Output 2

Yes

We can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort < tslaa.

Sample Input 3

cd
abc

Sample Output 3

No

No matter how we rearrange cd and abc, we cannot achieve our objective.

Sample Input 4

w
ww

Sample Output 4

Yes

Sample Input 5

zzz
zzz

Sample Output 5

No



Sample input:
yx
axy


Sample output:
Yes

Submission status: Accepted

Solution code:
# a = list(map(int, input().split()))　:スペース区切り入力

s = input()
t = input()

x = len(s)
y = len(t)

p = []
q = []

for i in range(x):
    p.append(ord(s[i]))

for j in range(y):
    q.append(ord(t[j]))

p.sort()
q.sort(reverse=True)

if p < q:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a=input().strip()
b=input().strip()
aa=[]
for i in a:
  aa.append(i)
aa.sort()
aaa="".join(aa)

bb=[]
for i in b:
  bb.append(i)
bb.sort(reverse=True)
bbb="".join(bb)
ccc=[aaa,bbb]
ccc.sort()

if bbb==ccc[0]:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

x = ''.join(sorted(s))
y = ''.join(sorted(t))
if x[0] < y[-1]:
    print ('Yes')
elif (x in y) and x != y:
    print ('Yes')
else:
    print ('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
# S = "cd"
# T = "abc"
sS = "".join(sorted(S))
sT = "".join(sorted(T, reverse = True))
if (sS < sT):
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

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

for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
        print("Yes")
        break
    elif s[i] == t[i]:
        if i == min(len(s),len(t))-1:
            if len(s) >= len(t):
                print("No")
            else:
                print("Yes")
    else:
        print("No")
        break

Submission status: Accepted

Solution code:
s=input()
t=input()
count=0
list01 = list(s)
list02 = list(t)
list01.sort()
list02 = list(t)
list02.sort()

if len(s)<len(t):
    for i in range(len(s)):
        if list01[i]>list02[len(t)-1-i]:
            print("No")
            break
        elif list01[i]<list02[len(t)-1-i]:
            print("Yes")
            break
    else:
            print("Yes")            

else:
    for i in range(len(t)):
        if list01[i]>list02[len(t)-1-i]:
            print("No")
            break

        elif list01[i]<list02[len(t)-1-i]:
            print("Yes")
            break
    else:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

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

s = list(s)
s.sort()

t = list(t)
t.sort()
t.reverse()

ans = "Yes" if ''.join(s) < ''.join(t) else "No"
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

# 入力
s = input()
t = input()

# sort
s = "".join(sorted(s))
t = "".join(sorted(t, reverse=True))
st_list = [s, t]

# 出力
if s == t:
    print("No")
elif st_list == sorted(st_list):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

S = sorted(list(s))
T = reversed(sorted(list(t)))
s = "".join(S)
t = "".join(T)
L = [s, t]
L2 = sorted(L)
if s == t:
    print("No")
else:
    if L == L2:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

s_list=[]
for i in range(len(s)):
    s_list.append(s[i])
# print(s_list)
t_list=[]
for i in range(len(t)):
    t_list.append(t[i])
s_list=sorted(s_list)
t_list=sorted(t_list,reverse=True)
# print(s_list,t_list)

ans=False
comp_max_index=min(len(s_list),len(t_list))
for i in range(min(len(s_list),len(t_list))):
    if s_list[i]<t_list[i]:
        ans=True
        break
if ans==True:
    print('Yes')
else:
    if s_list[comp_max_index-1]==t_list[comp_max_index-1] and len(s_list)<len(t_list) :
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

ss = s[::-1]
tt = t[::-1]
ss.sort()
tt.sort()

if(min(s) < max(t) or (len(s) < len(t) and ss == tt[:len(s)])):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

is_short = len(s) < len(t)

sd = sorted(s)
td = sorted(t)

for v in td:
    if ord(sd[0]) < ord(v):
        print('Yes')
        sys.exit()

if len(set(sd)) == 1 and len(set(td)) == 1 and is_short:
    print('Yes')
    sys.exit()

print('No')

Submission status: Accepted

Solution code:
ss=input()
tt=input()
s=[]
t=[]
for i in ss:
    s.append(i)
for i in tt:
    t.append(i)
sss=sorted(s)
ttt=sorted(t)
ssss=""
tttt=""
for i in sss:
    ssss+=i
for i in range(len(ttt)):
    tttt+=ttt[len(ttt)-i-1]
if ssss<tttt:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
sli = list(s)
tli = list(t)
sli.sort()
tli.sort()
tli.reverse()
def tostr(lis):
    hoge = ""
    for i in lis:
        hoge += i
    return hoge
tstr = tostr(tli)
sstr = tostr(sli)
if tstr > sstr:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

slist = [ord(i) for i in s]
tlist = [ord(i) for i in t]
slist.sort()
tlist.sort()
tlist.reverse()

if slist < tlist:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().strip()
t = input().strip()
ls = list(s)
lt = list(t)
ls.sort()
lt.sort()
lt.reverse()
s1 = ''.join(ls)
t1 = ''.join(lt)
if s1 < t1:
   print('Yes')
else:
   print('No')

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
s1, t1 = "", ""
for i in range(len(s)):
    s1 += s[i]
for i in range(len(t)):
    t1 += t[i]

if s1 < t1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
ans = "Yes"
s.sort()
t.sort(reverse=True)
for i in range(len(s)):
    try:
        if t[i] > s[i]:
            break
        elif t[i] == s[i]:
            pass
        else:
            ans = "No"
    except:
        if len(t) < len(s):
            ans = "No"
if s == t:
    ans = "No"
print(ans)

Submission status: Accepted

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

s = [i for i in input()]
t = [i for i in input()]
s.sort()
t.sort(reverse=True)
sp = "".join(s)
tp = "".join(t)
if sp < tp:
    print('Yes')
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s=sorted(input())
t=sorted(input(),reverse=True)
if s<t:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def main():
    S, T = (input() for _ in [0] * 2)

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

main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = list(input())
t = list(input())
s = ''.join(sorted(s))
t = ''.join(sorted(t, reverse=True))
print('Yes' if (s < t) else 'No')

Submission status: Accepted

Solution code:
import sys

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

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

r = s < t

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

Submission status: Accepted

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

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

flag = False
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        flag = True
        break
    elif s[i] > t[i]:
        flag = False
        break
    else:
        if i == min(len(s), len(t)) - 1:
            if len(s) < len(t):
                flag = True
            else:
                flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
s=list(input())
t=list(input())
if(sorted(s)<sorted(t,reverse=True)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:


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

st = ''.join(sorted(s))
tt = ''.join(sorted(t, reverse=True))

if st < tt:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

if (a.sort(reverse=True) < b.sort()):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

l="abcdefghijklmnopqrstuvwxyz"

ss=''.join(sorted(s))
st=''.join(sorted(t))
str=''.join(sorted(t,reverse=True))

if l.index(str[1])>l.index(ss[1]):
  ans="Yes"
elif len(t)>len(s) and ss in st:
  ans="Yes"
else:
  ans="No"
  
print(ans)

Submission status: Runtime Error

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)):
  c=c+c[i]
for i in range(len(b)):
  d=d+d[i]
if c<d:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

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

Submission status: Runtime Error

Solution code:
s,t = map(str, input().split())
k = 28
l = -1
alp = "abcdefghjklmnopqrstuvwxyz"
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: Runtime Error

Solution code:
s,t = map(str,input().split())
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: Runtime Error

Solution code:
s,t = map(str,input().split())
k = 28
l = -1
alp = "abcdefghjklmnopqrstuvwxyz"
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: Runtime Error

Solution code:
s,t = map(str,input().split())
k = 28
l = -1
alp = "abcdefghjklmnopqrstuvwxyz"
for i in range(len(s)):
  for j in range(26):
    if(s[i]==apl[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: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = sorted(x for x in input())
T = sorted([x for x in input()], reverse=True)
for s,t in zip(S,T):
    if s < t:
        ans = 'Yes'
        break
    if s > t:
        ans = 'No'
print(ans)

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
for i in s:
  for j in t:
    if ord(i)<ord(j):
      print("Yes")
      exit()
 
count = 0
if len(s)<len(t):
  for i in range(len(s)):
    if s[i]=t[i]:
      count+=1
  if count = len(s):
    print("Yes")
    exit()
 
print("No")
    
s = list(input())
t = list(input())
for i in s:
  for j in t:
    if ord(i)<ord(j):
      print("Yes")
      exit()

S = sorted(s)
T = sorted(t)
count = 0
if len(s)<len(t):
  for i in range(len(s)):
    if S[i]=S[i]:
      count+=1
  if count = len(s):
    print("Yes")
    exit()

print("No")

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
for i in s:
  for j in t:
    if ord(i)<ord(j):
      print("Yes")
      exit()

count = 0
if len(s)<len(t):
  for i in range(len(s)):
    if s[i]=t[i]:
      count+=1
  if count = len(s):
    print("Yes")
    exit()

print("No")

Submission status: Runtime Error

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

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

answer = "Yes"
for i in range(len(s)):
  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: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


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

    s = [ord(i) for i in sorted(s)]
    t = [ord(i) for i in sorted(t)]
    t.reverse()

    cnt = 0
    for x in s:
        if x < t[cnt]:
            print("Yes")
            sys.exit()
        elif x > t[cnt]:
            print("No")
            sys.exit()
        else:
            cnt += 1

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
s=input()
t=input()
s.sort()
t.sort(reverse=True)
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: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
s=input()
t=input()
if s==t:
  print("No")
  sys.exit()
S=list(s)
T=list(t)
for i in s:
  if i in t:
    S.remove(i)
    T.remove(i)
S.sort()
T.sort()
a="".join(S)
b="".join(T)
if b=="":
  print("No")
  sys.exit()
if a=="":
  print("Yes")
  sys.exit()
for j in b:
  if ord(a[0])<ord(j):
    print("Yes")
    break
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
s=input()
t=input()
if s==t:
  print("No")
  sys.exit()
S=list(s)
T=list(t)
for i in s:
  if i in t:
    S.remove(i)
    T.remove(i)
S.sort()
T.sort()
a="".join(S)
b="".join(T)
if a=="":
  print("Yes")
  sys.exit()
for j in b:
  if ord(a[0])<ord(j):
    print("Yes")
    break
else:
  print("No")

Submission status: Runtime Error

Solution code:
s,t=map(str,input().split())
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: Runtime Error

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


def solve(H: int, W: int, A: "List[List[int]]", B: "List[List[int]]"):
    from itertools import chain
    dp = [[set() for _ in range(W+1)] for _ in range(H+1)]
    dp[0][0].add(0)
    for h in range(H):
        for w in range(W):
            d = A[h][w] - B[h][w]
            for v in dp[h][w]:
                dp[h+1][w].add(v+d)
                dp[h+1][w].add(v-d)
                dp[h][w+1].add(v+d)                                            
                dp[h][w+1].add(v-d)
    return min(map(abs, chain(dp[H-1][W], dp[H][W-1])))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [[int(next(tokens)) for _ in range(W)] for _ in range(H)]  # type: "List[List[int]]"
    B = [[int(next(tokens)) for _ in range(W)] for _ in range(H)]  # type: "List[List[int]]"
    print(solve(H, W, A, B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = [input() for i in range(2)]

sp = "".join(sorted(list(a[0])))
tmp = list(a[1])
tmp.sort().reverse()
tp = "".join(tmp)

if sp < tp:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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: Runtime Error

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 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: Runtime Error

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
# print(s,t)
if "".join(s) < "".join(t):
    print("Yes")
else:
    print("No")import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=list(list(i for i in input()).sort())
t=list(list(i for i in input()).sort()(reverse=True))
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: Runtime Error

Solution code:
s=[i for i in input()].sort()
t=[i for i in input()].sort()(reverse=True)
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: Runtime Error

Solution code:
s=list(input().split()).sort()
t=list(input().split()).sort()(reverse=True)
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: Runtime Error

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)):
  if S[k] > T[k]:
    print("No")
    sys.exit()
  elif S[k] < T[k]:
    print("Yes")
    sys.exit()
  else:
    None
if len(S) <= len(T):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
impport sys
S = [ord(i) for i in input()]
T = [ord(j) for j in input()]
S.sort()
T.sort()
for k in range(len(S)):
  if S[k] > T[k]:
    print("No")
    sys.exit()
  elif S[k] < T[k]:
    print("Yes")
    sys.exit()
  else:
    None
if len(S) <= len(T):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
s = input()
t = 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: Runtime Error

Solution code:
s=list(input())
t=list(input())
s.sort()
t.sort()
if s==t and s.count(s[0])==len(s) and t.count(s[0])==len(t):
  print('No')
  elif s.count(s[0])==len(s) and t.count(s[0])==len(t):
    if len(s)<len(t):
      print('Yes')
    else:
      print('No')
  else:
    if ord(s[0])==ord(t[-1]):
      print('No')
    elif ord(s[0])<ord(t[-1]):
      print('Yes')
    else:
      print('No')

Submission status: Runtime Error

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: Runtime Error

Solution code:
N = int(input())

city = []
member = []

for i in range(N):
    S,P = input().split()
    city.append(S)
    member.append(int(P))

if max(member) > sum(member)//2 :
        print(city[member.index(max(P))])
else:
    print('atcorder')

Submission status: Runtime Error

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

print('YNeos'[S>=::2])

Submission status: Runtime Error

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

while(i < len(s)):
  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: Runtime Error

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


for i in range(101):
  if min(s) > max(t):
    print('No')
    exit()
    
  elif min(s) == max(t):
    s.remove(min(s))
    t.remove(max(t))
    if s == [] and t != []:
      print('Yes')
      exit()
    elif s == [] and t == []:
      print('No')
      exit()
    
  if min(s) < max(t):
    print('Yes')
    exit()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))

ans = 1


for i in A:
    ans *= i
if ans < 1000000000000000000:
    print(ans)
else:
    print('-1')

Submission status: Runtime Error

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

s_index = []
t_index = []
for i in s:
  s_index.append(alpha.index(s))
for i in t:
  t_index.append(alpha.index(t))
  
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: Runtime Error

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(a)[0] #sの最小の文字

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
s = input()
t = input()
n = len(s)
m = len(t)

ss = [s[i] for i in range(n)]
tt = [t[i] for i in range(m)]
ss.sort()
tt.sort(reverse=True)

for i in range(n):
    if ss[i] < tt[i]:
        print('Yes')
        exit()
    elif ss[i] > tt[i]:
        print('No')
        exit()

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