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().split())
t=list(input().split())

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

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

Submission status: Wrong Answer

Solution code:
# B - Two Anagrams
# coding: utf-8

A = list(raw_input())
B = list(raw_input())
A.sort()
B.sort(), B.reverse()

print A < B

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 = input()
T = input()
num = 0

T = sorted(T,reverse=True)
while num < min(len(S),len(T)):
    if  S[num] < T[num]:
        print('Yes')
        break
    elif S[num] > T[num]:
        print('No')
        break
    num += 1
if num == len(T):
    print('No')
elif num == len(S):
    print('Yes')

Submission status: Wrong Answer

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

T = sorted(T,reverse=True)
while num < min(len(S),len(T)):
    if  S[num] < T[num]:
        print('Yes')
        break
    elif S[num] > T[num]:
        print('No')
        break
    num += 1
if num == len(S):
    print('Yes')
elif num == len(T):
    print('No')

Submission status: Wrong Answer

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

  sd=list(s)
  sd.sort()
  td=list(t)
  td.sort(reverse=True)

  for (sc,tc) in zip(sd,td):
    if sc<tc:
      print("Yes")
      return
  print("No")

main()

Submission status: Wrong Answer

Solution code:
#sを最高のパターンにして，tを最悪のパターンにすればいい
#continueで強制的に次のループへ
s = list(input())
t = list(input())
condition = 0

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

if len(s)  == len(t):
    length = len(s)
    pattern = -1
elif len(s) < len(t):
    length = len(s)
    pattern = 0
else:#sのほうが長い時 pattern = 1
    length = len(t)
    pattern = 1

if pattern == -1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] > t[i]:
            print("Yes")
            condition =1
            break
        else:
            print("No")
            condition =1
            break
    if condition == 0:
        print("No")
elif pattern == 0:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            condition =1
            break
        else:
            print("No")
            condition =1
            break
    
    if condition == 0:
        print("Yes")
elif pattern == 1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            condition =1
            break
        else:
            print("No")
            condition =1
            break
            
    if condition == 0:
        print("No")

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    t = S()
    s = ''.join(sorted([c for c in t]))
    t = ''.join(sorted([c for c in t], reverse=True))
    if s < t:
        return 'Yes'

    return 'No'



print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    t = S()
    t = ''.join(sorted([c for c in t], reverse=True))
    if s < t:
        return 'Yes'

    return 'No'



print(main())

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
#s,t = map(list, input().split())
s = list(input())
t = list(input())

if len(s) < len(t):
    t2 = t.copy()
    for l in s:
        if l in t2:
            del t2[t2.index(l)]
        else:
            break
    else:
        print('yes')
        sys.exit()

s.sort()
t.sort()

if s[0] < t[-1]:
    print ('yes')
    sys.exit()
    
print('no')

Submission status: Wrong Answer

Solution code:
import string

alphabet = {}
n  = 0
for i in string.ascii_lowercase:
    alphabet[i] = n
    n += 1
    
s = list(input().rstrip())
t = list(input().rstrip())



for i in range(len(s)):
    s[i] = alphabet[s[i]]
    
for i in range(len(t)):
    t[i] = alphabet[t[i]]
    

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

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

Submission status: Wrong Answer

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

sl = list(s)
sl.sort()
s = ''.join(sl)
tl = list(t)
tl.sort(reverse=True)
t = ''.join(tl)

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

Submission status: Wrong Answer

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

sl = list(s)
sl.sort()
s = ''.join(sl)
tl = list(t)
tl.sort(reverse=True)
t = ''.join(tl)

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

Submission status: Wrong Answer

Solution code:
s=input()
l=len(s)
d=list(s)

d.sort()

g=input()
k=len(g)
v=list(g)

v.sort()
v.reverse()

for i in range (100):
    if ord(d[i])<ord(v[i]):
        print('Yes')
        break
    elif l>=k: 
        print('No')
        break
    elif l<k:
        print('Yes')
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s.sort()
t.sort()

if s[0] < t[-1]:
    print "Yes"
elif s[0] == t[-1] and len(s)  < len(t):
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

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

sn=[ord(s[i]) for i in range(len(s))]
tn=[ord(t[i]) for i in range(len(t))]

sn.sort()
tn.sort()

for i in range(min(len(tn), len(sn))):
    if tn[i] > sn[i]:
        print('Yes')
        sys.exit()
    elif tn[i] < sn[i]:
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 19 13:54:17 2017

@author: kotania
"""

s = input()
t = input()

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

s_list.sort()
t_list.sort()
t_list.reverse()

N = len(s_list)
M = len(t_list)

minNM = min(N,M)

flag = True
for n in range(0,minNM):
    if s_list[n] < t_list[n]:
        break
    elif s_list[n] > t_list[n]:
        flag = False
        break
    
if s == t :
    flag = False
    
    
if flag :
    print ("Yes")
else :
    print ("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
u=min(s)
v=max(t)
if u<v:
 print('Yes')
else:
 print('No')

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
u=min(s)
v=max(t)
if u<v:
 print('Yes')
else:
 print('No')

Submission status: Wrong Answer

Solution code:

input_data_a = input()
input_data_b = input()

a = sorted(input_data_a, reverse=True)
b = sorted(input_data_b, reverse=True)


if a >= b :
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter
import collections
round = lambda x:(x*2+1)//2
a = input()
b = input()
a = list(a)
b = list(b)
b = sorted(b,reverse = True)
a = sorted(a)
#a = a[1:]
a = "".join(a)
b = "".join(b)
print(a)
print(b)
if a <  b :
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter
import collections
a = input()
b = input()
a = list(a)
b = list(b)
b = sorted(b,reverse = True)
a = sorted(a)
a = str(a)
b = str(b)
if a <  b :
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter
import collections
round = lambda x:(x*2+1)//2
a = input()
b = input()
a = list(a)
b = list(b)
b = sorted(b,reverse = True)
a = sorted(a)
a = a[1:]
a = "".join(a)
b = "".join(b)

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

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter
import collections
round = lambda x:(x*2+1)//2
a = input()
b = input()
a = list(a)
b = list(b)
b = sorted(b,reverse = True)
a = sorted(a)
a = str(a)
b = str(b)
if a >  b :
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
#coding:utf-8
def main():
    s = raw_input()
    t = raw_input()
    if min(s) <  max(t):
        print "Yes"
    elif min(s) ==  max(t) and len(s) < len(t):
        print "Yes"
    else:
        print "No"

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

a = "".join( sorted( list(a) ) )
b = "".join( sorted( list(b) ) )

yes = True
printed = False

if len(a) < len(b):
    i = 0
    while i < len(a):
        if a[i] != b[i]:
            yes = False
            break
        i += 1
    if yes:
        print "Yes"
        printed = True

if not printed:
    i = 0
    b = "".join( sorted( list(a), reverse = True ) )

    while i < len(a):
        if a[i] < b[i]:
            print "Yes"
            printed = True
            break
        elif a[i] > b[i]:
            print "No"
            printed = True
            break
        i += 1
    if not printed:
        print "No"

if not printed:
    print "Yes"
    printed = True

Submission status: Wrong Answer

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

a = "".join( sorted( list(a) ) )
b = "".join( sorted( list(b) ) )

printed = False

if len(a) < len(b):
    i = 0
    while i < len(a):
        if a[i] != b[i]:
            print "No"
            printed = True
            break
        i += 1
    if not printed:
        print "Yes"
        printed = True
else:
    i = 0
    b = "".join( sorted( list(a), reverse = True ) )
    while i < len(a) and i < len(b):
        if a[i] < b[i]:
            print "Yes"
            printed = True
            break
        elif a[i] > b[i]:
            print "No"
            printed = True
            break
        i += 1
    if not printed:
        print "No"

Submission status: Wrong Answer

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

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

the_same = 0
flg = False
for S, T in zip(sorted_s, sorted_t):
    if ord(S) == ord(T):
        the_same += 1
        continue
    elif ord(S) > ord(T):
        print('No')
        flg = True
        break
    elif ord(S) < ord(T):
        print('Yes')
        flg = True
        break

if the_same == len(s) and len(s) < len(t) and not flg:
    print('Yes')
elif the_same == len(s) and len(s) > len(t) and not flg:
    print('No')
elif the_same == len(s) == len(t):
    print('No')

Submission status: Wrong Answer

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

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

the_same = 0
flg = False
for S, T in zip(sorted_s, sorted_t):
    if ord(S) == ord(T):
        the_same += 1
        continue
    elif ord(S) > ord(T):
        print('No')
        flg = True
        break
    elif ord(S) < ord(T):
        print('Yes')
        flg = True
        break

if the_same == len(s) and len(s) < len(t) and not flg:
    print('Yes')
elif the_same == len(s) and len(s) > len(t) and not flg:
    print('No')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

Submission status: Wrong Answer

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

ss,tt = sorted(s),sorted(t,reverse=True)
for i in range(min(len(ss),len(tt))):
    if ss[i] < tt[i]:
        print("Yes")
        break
else:
    if len(tt) <= len(ss):
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

flag = 0
outflag = 0
yflag = 0
s = sorted(s)
t = sorted(t)
for i in range(len(s)):

	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			flag = 1
			outflag=1
			yflag = 1
			break
		elif ord(t[j])<ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break
	elif outflag==1 and yflag == 1:
		break

if yflag == 0 and outflag == 0 and flag == 1 and len(s)<len(t):
	print "Yes"
elif (outflag == 0 and flag == 1 and yflag == 0) and (len(s)>len(t) or len(s)==len(t)):
	print "No"

Submission status: Wrong Answer

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

flag = 0
outflag = 0
yflag = 0
for i in range(len(s)):

	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			flag = 1
			outflag=1
			yflag = 1
			break
		elif ord(t[j])<ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break
	elif outflag==1 and yflag == 1:
		break

if yflag == 0 and outflag == 0 and flag == 1 and len(s)<len(t):
	print "Yes"
elif (outflag == 0 and flag == 1 and yflag == 0) and (len(s)>len(t) or len(s)==len(t)):
	print "No"

Submission status: Wrong Answer

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

flag = 0
outflag = 0
yflag = 0
for i in range(len(s)):

	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			flag = 1
			outflag=1
			yflag = 1
			break
		elif ord(t[j])<ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break
	elif outflag==1 and yflag == 1:
		break

if outflag == 0 and flag == 1 and len(s)<len(t):
	print "Yes"
elif (outflag == 0 and flag == 1) and (len(s)>len(t) or len(s)==len(t)):
	print "No"

Submission status: Wrong Answer

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

flag = 0
outflag = 0
for i in range(len(s)):
	
	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			flag = 1
			outflag=1
			break
		elif ord(t[j])<ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break
	elif outflag ==1 :
                break

if outflag == 0 and flag == 1 and len(s)<len(t):
	print "Yes"
elif (outflag == 0 and flag == 1) and (len(s)>len(t) or len(s)==len(t)):
	print "No"

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

A = list(input())
B = list(input())
A.sort()
B.reverse()

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

Submission status: Wrong Answer

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

flag = 0
outflag = 0
for i in range(len(s)):
	
	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			flag = 1
			outflag=1
			break
		elif ord(t[j])<ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break
	elif outflag ==1 :
                break

if outflag == 0 and flag == 1 and len(s)<len(t):
	print "Yes"
elif outflag == 0 and flag == 1 and len(s)>len(t) or len(s)==len(t):
	print "No"

Submission status: Wrong Answer

Solution code:

def solve():
    s = list(input())
    t = list(input())
    s.sort()
    t.sort()
    
    s.reverse()
    t.reverse()
    
    if "".join(t) > "".join(s):
        print("Yes")
    else:
        print("No")

solve()

Submission status: Wrong Answer

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

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

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		exit(0)

	else:
		print("No") 
		exit(0)

if len(s) < len(t):
	print("Yes")

else:
	print("No")

Submission status: Wrong Answer

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

flag = 0
outflag = 0
for i in range(len(s)):
	
	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			flag = 1
			outflag=1
			break
		elif ord(t[j])<ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break
	elif outflag ==1 :
                break

if outflag == 0 and flag == 1 and len(s)<len(t):
	print "Yes"
elif outflag == 0 and flag == 1 and len(s)>len(t):
	print "No"

Submission status: Wrong Answer

Solution code:
def solve():
    s = list(input())
    t = list(input())
    s.sort()
    t.sort()
    
    if "".join(t) > "".join(s):
        print("Yes")
    else:
        print("No")

solve()

Submission status: Wrong Answer

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

flag = 0
outflag = 0
for i in range(len(s)):
	
	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			flag = 1
			outflag=1
			break
		elif ord(t[j])<ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break
	elif outflag ==1 :
                break

if outflag == 0 and flag == 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()
t.reverse()

for S,T in zip(s,t):
	if 'S' == 'T':
		pass

	elif ord(S) < ord(T):
		print("Yes")
		exit(0)

	elif ord(T) > ord(S):
		print("No") 
		exit(0)

if len(s) < len(t):
	print("Yes")

else:
	print("No")

Submission status: Wrong Answer

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

flag = 0
outflag = 0
for i in range(len(s)):
	
	for j in range(len(t)):
		if ord(t[j])>ord(s[i]):
			print "Yes"
			outflag=1
			break
		elif ord(t[j])>ord(s[i]):
			flag = 0
		elif ord(t[j])==ord(s[i]):
			flag = 1
			break
	if flag == 0:
		print "No"
		outflag=1
		break

if outflag==0 and flag == 1 and len(s)<len(t):
	print "Yes"

Submission status: Wrong Answer

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

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

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		exit(0)

	else :
		print("No") 
		exit(0)

if len(s) < len(t):
	print("Yes")

else:
	print("No")

Submission status: Wrong Answer

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

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

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		exit(0)

	else :
		print("No") 
		exit(0)

if len(S) < len(T):
	print("Yes")

else:
	print("No")

Submission status: Wrong Answer

Solution code:
def b_two_anagrams(S, T):
    s = ''.join(sorted(S, reverse=True))
    t = ''.join(sorted(T, reverse=True))
    l_s = len(s)
    l_t = len(t)
    length = min(l_s, l_t)
    if s==t:
        return 'No'
    for i in range(length):
        if s[i] < t[i]:
            return 'Yes'
        elif s[i] > t[i]:
            return 'No'
    if l_s > l_t:
        return 'No'
    elif l_s < l_t:
        return 'Yes'
  
S = input()
T = input()
print(b_two_anagrams(S, T))

Submission status: Wrong Answer

Solution code:
a=raw_input()
b=raw_input()
a=list(a)
a.sort()
b=list(b)
b.sort()
b.reverse()
print a,b
ch=0
for i in range(len(b)):
    if len(a)-1>=i:
        print a[i],b[i]
        if a[i]<b[i]:
            ch=1
            break
    else:
        print a[:i],b[:i]
        if a[:i]==b[:i]:
            ch=1

if ch==1:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
s_input = input()
t_input = input()

s = list(s_input)
t = list(t_input)

s_sort = sorted(s)
t_sort = sorted(t)

R=0
P=0
for i in range(0, len(s)):
    for j in range(0, len(t)):
        if(s[i]==t[j]):
            P+=1
            break
        if(s[i] < t[j]):
            R=1
            break

if(P==len(s) and len(s)<len(t)):
    R=0

if(R==0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def b_two_anagrams(S, T):
    s = ''.join(sorted(S, reverse=True))
    t = ''.join(sorted(T, reverse=True))
    l_s = len(s)
    l_t = len(t)
    length = min(l_s, l_t)
    for i in range(length):
        if s[i] < t[i]:
            return 'Yes'
        elif s[i] > t[i]:
            return 'No'
    if l_s >= l_t:
        return 'No'
    elif l_s < l_t:
        return 'Yes'
  
S = input()
T = input()
print(b_two_anagrams(S, T))

Submission status: Wrong Answer

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

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

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		exit(0)

	else :
		print("No") 
		exit(0)

print("No")

Submission status: Wrong Answer

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

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

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		break

	else :
		print("No") 
		break

print("No")

Submission status: Wrong Answer

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

s.sort()
t.reverse()

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		break

	else :
		print("No") 
		break

print("No")

Submission status: Wrong Answer

Solution code:
def solve():
    while 1:
        try:
            s = list(input())
            t = list(input())
            k = set(s)
            l = set(t)
            if k == l:
                if len(t) > len(s):
                    print("Yes")
                else:
                    print("No")
                raise EndLoop

            s.sort()
            t.sort()

            s.reverse()
            t.reverse()
            if "".join(t) > "".join(s):
                print("Yes")
            else:
                print("No")
            break
        except:
            break


solve()

Submission status: Wrong Answer

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

s.sort()
t.reverse()

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		break

	else :
		print("No") 
		break

Submission status: Wrong Answer

Solution code:
A = input()		# 文字列の入力  abcdefg...
B = input()		# 文字列の入力  abcdefg...

a=[0]*26
b=[0]*26


for c in A:
	#print(c, ord(c), ord(c)-97)
	a[ord(c)-97] += 1

for c in B:
	b[ord(c)-97] += 1


#print(a)
#print(b)

ans = "No"
bBNo=True
for i in range(26):
	if b[i] > 0: bBNo=False
	if a[i] == 0: continue
	
	if sum(b[i+1:])>0:
		ans = "Yes"
		break

	if a[i] < b[i]:
		ans = "Yes"
		break


	if a[i] == b[i]:
		if sum(b[0:i]) >0:
			ans = "Yes"
		else:
			ans = "No"
		break
		
	if a[i] > b[i]:
		ans = "No"
		break
	

#	if a[i] > b[i] and sum(b[i:])>0:
#		ans = "Yes"
#		break
#	
#	if a[i] < sum(b[i:]):
#		ans = "Yes"
#		break
#	
#	if bBNo and (sum(b[i:]) > 0):
#		ans = "Yes"
#		break

else:
	ans = "Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

A = list(input())
B = list(input())
A.sort()
B.reverse()

for i in range(len(B)):
    if i is len(A):
        print('Yes')
        sys.exit()
    if ord(B[i]) > ord(A[i]):
        print('Yes')
        sys.exit()
    if ord(B[i]) < ord(A[i]):
        print('No')
        sys.exit()
print('No')

Submission status: Wrong Answer

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

a = sorted(a)
b = sorted(b)
new_a = []
new_b = []
for x in a:
  if ord(x) >= ord('a') and ord(x) <= ord('z'):
     new_a.append(x)
      
for x in b:
  if ord(x) >= ord('a') and ord(x) <= ord('z'):
     new_b.append(x)

new_a = new_a
new_b = new_b[::-1]
la = len(new_a)
lb = len(new_b)

for x in range(100):
  if x >= lb:
    print "No"
    exit(0)
  if x >= la:
    print "Yes"
    exit(0)
  if ord( new_a[x] ) > ord( new_b[x] ):
    print "No"
    exit(0)
  if ord( new_a[x] ) < ord( new_b[x] ):
    print "Yes"
    exit(0)

Submission status: Wrong Answer

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

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

i = 0
j = len(t)-1
flag = False

while True:
    if s[i] < t[j]:
        flag = True
        break
    if s[i] == t[j]:
        del s[i]
        del t[j]
        if not s:
            if t:
                flag = True
                break
            else:
                flag = False
                break
        if not t:
            flag = False
            break
    j -= 1
    if j >= -1:
        i += 1
        j = len(t) - 1
    if i >= len(s):
        flag = False
        break


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

Submission status: Wrong Answer

Solution code:
def solve():
    while 1:
        try:
            s = list(input())
            t = list(input())
            k = set(s)
            l = set(t)
            if k == l:
                if len(t) > len(s):
                    print("Yes")
                else:
                    print("No")

                raise EndLoop

            for ele_t in t:
                for ele_s in s:
                    if ele_t > ele_s:
                        print("Yes")
                        raise EndLoop

            print("No")
            break
        except:
            break


solve()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
A = list(input())
B = list(input())
A.sort()
B.reverse()

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

Submission status: Wrong Answer

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

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

i = 0
j = len(t)-1
flag = False

while True:
    if s[i] < t[j]:
        flag = True
        break
    if s[i] == t[j]:
        del s[i]
        del t[j]
        if not s:
            if t:
                flag = True
                break
            else:
                break
    j -= 1
    if j >= -1:
        i += 1
        j = len(t) - 1
    if i >= len(s):
        break


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

Submission status: Wrong Answer

Solution code:
import string
lisL = list(string.ascii_lowercase)
dic = dict(zip(lisL,list(range(26))))
s = input()
t = input()
lisT = list(reversed(t))
lisS = list(sorted(s))
for sitem,titem in zip(lisS[0:min( len(lisT),len(lisS) )],lisT[0:min( len(lisT),len(lisS) )]):
  if dic[sitem] < dic[titem]:
    print ("Yes")
    break
  elif dic[sitem] > dic[titem]:
    print ("No")
    break
else:
  if len(lisT) > len(lisS):
    print ("Yes")
  else:
    print ("No")

Submission status: Wrong Answer

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

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

i = 0
j = 0
flag = False

while True:
    if s[i] < t[j]:
        falg = True
        break
    if s[i] == t[j]:
        del s[i]
        del t[j]
        if not s:
            if t:
                flag = True
                break
            else:
                break
    j += 1
    if j >= len(t):
        i += 1
        j = 0
    if i >= len(s):
        break


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

Submission status: Wrong Answer

Solution code:
A = input()		# 文字列の入力  abcdefg...
B = input()		# 文字列の入力  abcdefg...

a=[0]*26
b=[0]*26


for c in A:
	#print(c, ord(c), ord(c)-97)
	a[ord(c)-97] += 1

for c in B:
	b[ord(c)-97] += 1


#print(a)
#print(b)

ans = "No"
bBChar=False
for i in range(26):
	if b[i] > 0: bBChar=True
	if a[i] == 0: continue
	
	if a[i] == b[i]: continue

	if a[i] > b[i] and sum(b[i:])>0:
		ans = "Yes"
		break
	
	if a[i] < sum(b[i:]):
		ans = "Yes"
		break
	
	if bBChar==False and (sum(b[i:]) > 0):
		ans = "Yes"
		break

else:
	ans = "Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

    length = min(len(s),len(t))
    for i in range(length):
        if(s[i] < t[i]):
            print('Yes')
            return
        elif(s[i] > t[i]):
            print('No')
            return

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

if __name__ == '__main__':
    solv()

Submission status: Wrong Answer

Solution code:
import string
if __name__=="__main__":
    s = list(input())
    t = list(input())
    flag = False
    dic = list(string.ascii_lowercase)
    c = 0
    for j in range(len(s)):
        if s[j] in t:
            c+=1
    if c==len(s) and c<len(t):
        print("Yes")
        exit()
    for i in range(len(dic)):
        if not flag and s.__contains__(dic[i]) and t.__contains__(dic[i]):
            flag = True
            continue
        if flag and s.__contains__(dic[i]) and not t.__contains__(dic[i]):
            for j in range(i+1,len(dic)):
                if t.__contains__(dic[j]):
                    print("Yes")
                    exit()
    print("No")

Submission status: Wrong Answer

Solution code:
A = input()		# 文字列の入力  abcdefg...
B = input()		# 文字列の入力  abcdefg...

a=[0]*26
b=[0]*26


for c in A:
	#print(c, ord(c), ord(c)-97)
	a[ord(c)-97] += 1

for c in B:
	b[ord(c)-97] += 1


#print(a)
#print(b)

ans = "No"
bBChar=False
for i in range(26):
	if b[i] > 0: bBChar=True
	if a[i] == 0: continue
	if a[i] < sum(b[i:]):
		ans = "Yes"
		break
	
	if bBChar==False and (sum(b[i:]) > 0):
		ans = "Yes"
		break



print(ans)