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

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

s_sorted = ''.join(sorted(s))
t_sorted = ''.join(sorted(t, reverse = True))

if s_sorted == t_sorted:
    print("No")
elif s_sorted < t_sorted:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(stdin.readline())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()


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

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

Solution (Python):
s=input()
t=input()
l=max(len(s),len(t))
slist = []
tlist = []
for i in range(l):
    if i < len(s):
        slist.append(s[i])
    if i < len(t):
        tlist.append(t[i])
slist.sort()
tlist.sort(reverse=True)
result = 'Yes'
if s==t:
    result = 'No'
else:
    for j in range(l):
        if j < len(s) and j < len(t):
            if slist[j] == tlist[j]:
                continue
            elif slist[j] < tlist[j]:
                break
            else:
                result = 'No'
                break
        elif len(s) > len(t):
            result = 'No'
            break
print(result)

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

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

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

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


list =[s,t]
list = sorted(list)

if list[0] == s:
    print("Yes")
else:
    print("No")

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

Solution (Python):
s = [c for c in input()]
t = [c for c in input()]
s.sort()
t.sort()
t = t[::-1]
if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):
s_input_sort = sorted(list(str(input())))
t_input_sort = sorted(list(str(input())), reverse=True)

s_str = "".join(s_input_sort)
t_str = "".join(t_input_sort)

if t_str > s_str:
  print("Yes")
else:
  print("No")

Solution (Python):
s_input_sort = sorted(list(str(input())))
t_input_sort = sorted(list(str(input())), reverse=True)

s_str = "".join(s_input_sort)
t_str = "".join(t_input_sort)

if s_str == t_str:
    print("No")
else:    
    if t_str < s_str:
        print("No")
    else:
        print("Yes")

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

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

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

Solution (Python):
s = str(input())
t = str(input())
S = list(s)
T = list(t)
S.sort()
T.sort()
T.reverse()
s = ''.join(S)
t = ''.join(T)
if s < t: print('Yes')
else: print('No')

Solution (Python):



import sys

def main():
    s, t = (line.strip() for line in sys.stdin.readlines())
    if sorted(s) < sorted(t, reverse=True):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
import sys

a=input()
b=input()
c=[]
d=[]
for i in range(len(a)):
    c.append(a[i])
for i in range(len(b)):
    d.append(b[i])
c.sort()
d.sort()
d.reverse()
for i in range(min([len(a),len(b)])):
    if(c[i]<d[i]):
        print("Yes")
        sys.exit()
if(len(a)<len(b)):
    if(a==b[0:len(a)]):
        print("Yes")
        sys.exit()
print("No")

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

B_Two_Anagrams()

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

Solution (Python):



L = [list(map(str, input().split())) for _ in range(2)]
s, t = list(L[0][0]), list(L[1][0])

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

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

Solution (Python):
def main():
    S = "".join(sorted(list(input())))
    T = "".join(sorted(list(input()), reverse=True))

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

main()

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

Solution (Python):
s=input()
t=input()
s1="".join(sorted(s));
t1="".join(sorted(t, reverse=True))
if s1<t1:
	print("Yes\n")
else:
	print("No\n")

Solution (Python):
s=sorted(list(input()))
t=reversed(sorted(list(input())))
print(["No","Yes"][int("".join(s)<"".join(t))])

Solution (Python):
s = raw_input()
t = raw_input()
ss = ''.join(sorted(list(s)))
ts = ''.join(sorted(list(t))[::-1])
if ss < ts:
	print 'Yes'
else:
	print 'No'

Solution (Python):
s = [c for c in input()]
t = [c for c in input()]

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

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

Solution (Python):


import sys

s = raw_input().split()[0]
t = raw_input().split()[0]


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




if sl < tl:
    sys.stdout.write('Yes\n')
else:
    sys.stdout.write('No\n')
sys.stdout.flush()

Solution (Python):
a = input()
b = input()
 
sort_a = ''.join(sorted(a))
sort_b = sorted(b)
r_b = sort_b[::-1]
rbs = ''.join(r_b)
 
if sort_a<rbs:
    print("Yes")
else:
    print("No")

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

sort_a = ''.join(sorted(a))
sort_b = sorted(b)
r_b = sort_b[::-1]
rbs = ''.join(r_b)

if sort_a<rbs:
    print("Yes")
else:
    print("No")

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

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

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

if sorted_s < reversed_t:
    print('Yes')
else:
    print('No')

Solution (Python):

"""
https://beta.atcoder.jp/contests/abc082/tasks/abc082_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(s, t):
    s.sort(reverse=False)
    t.sort(reverse=True)
    if t > s:
        return 'Yes'
    else:
        return 'No'


def main(args):
    s = list(input().strip())
    t = list(input().strip())
    ans = solve(s, t)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
s = list(map(lambda x: ord(x) - 96, input()))
t = list(map(lambda x: ord(x) - 96, input()))
N = len(s)
M = len(t)
s.sort()
t.sort(reverse=True)
s.extend([0] * max(M - N, 0))
t.extend([0] * max(N - M, 0))
for i in range(max(N, M)):
	if s[i] == t[i]:
		continue
	print("Yes" if s[i] < t[i] else "No")
	break
else:
	print("No")

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

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

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

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

ss = sorted(s)
tt = sorted(t, reverse=True)
print("Yes" if ss < tt else "No")

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

sL = [i for i in s]
tL = [i for i in t]
sL.sort()
tL.sort(reverse=True)

if sL < tL:
    print("Yes")
else:
    print("No")

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

Solution (Python):





def main():
    S = input()
    T = input()

    ok = sorted(S) < sorted(T, reverse=True)
    print("Yes" if ok else "No")

if __name__ == "__main__": main()

Solution (Python):
def solve():
    s = input()
    t = input()
    
    s_asc = "".join(sorted(s))
    t_desc = "".join(sorted(t, reverse=True))
    
    if s_asc < t_desc:
        print("Yes")
    else:
        print("No")

solve()

Solution (Python):
s=list(input())
s.sort()
t=list(input())
t.sort()
t.reverse()
if t > s:
    print('Yes')
else:
    print('No')

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

ss = sorted(list(s))
tt = sorted(list(t))[::-1]

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

Solution (Python):


def foo(s, t):
    if "".join(sorted(list(s))) < "".join(sorted(list(t), reverse=True)):
        return "Yes"
    else:
        return "No"

if __name__ == "__main__":
    s = input()
    t = input()
    print(foo(s, t))

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

Solution (Python):

s = input()
s_asc = ''.join(sorted(s))

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

if s_asc < t_desc:
    print('Yes')
else:
    print('No')

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

s_sorted = ''.join(sorted(s))
t_sorted = ''.join(sorted(t, reverse=True))

word_list = [s_sorted, t_sorted]
word_list.sort()

if word_list[0] == s_sorted and s_sorted != t_sorted:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
s = list(str(input()))
t = list(str(input()))
ss = sorted(s)
st = sorted(t)
rst = sorted(t, reverse=True)

if (len(s) < len(t)):
    if (''.join(ss) == ''.join(t[:len(s)])):
        print('Yes')
        sys.exit()
m = min(len(s), len(t))
for i in range(m):
    
    if (ss[i] < rst[i]):
        print('Yes')
        sys.exit()
print('No')

Solution (Python):
s = input()
t = input()
sd = sorted(s,key=lambda a:ord(a))
td = sorted(t,key=lambda a:-ord(a))
if len(sd) == len(td):
    for sm, tm in zip(sd, td):
        if ord(sm) < ord(tm):
            print('Yes')
            exit()
        elif ord(sm) > ord(tm):
            print('No')
            exit()
    print('No')
else: 
    minsize = min(len(s), len(t))
    sd = sd[:minsize]
    td = td[:minsize]
    if sd == td:
        if len(s) < len(t):
            print('Yes')
        else:
            print('No')
    else:
        for sm, tm in zip(sd, td):
            if ord(sm) < ord(tm):
                print('Yes')
                exit()
            elif ord(sm) > ord(tm):
                print('No')
                exit()
        print('No')

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

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

print('Yes' if s1 < t1 else 'No')

Solution (Python):
if __name__ == "__main__":
    S = list(input())
    T = list(input())
    S.sort()
    T.sort()
    T = list(reversed(T))
    if S < T:
        print ("Yes")
    else:
        print ("No")

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

s_sorted = ''.join(sorted(list(s)))
t_sorted = ''.join(reversed(sorted(list(t))))

if s_sorted < t_sorted:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
s = input()
t = input()
ss = [x for x in s]
tt = [x for x in t]
sss = ''.join(sorted(ss))
ttt = ''.join(sorted(tt, reverse=True))
if sss < ttt:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
S = sorted(list(input()))
T = sorted(list(input()))

for s in S:
    for t in T:
        if s < t:
            print("Yes")
            exit(0)
else:
    for s in S:
        if s not in T:
            print("No")
            break
    else:
        if len(S) < len(T):
            print("Yes")
        else:
            print("No")

Solution (Python):
l = list(str(raw_input()))
k = list(str(raw_input()))

l.sort()
l = "".join(l)
k = sorted(k, reverse=True)
k = "".join(k)

if l < k:
    print "Yes"
else:
    print "No"

Solution (Python):
S=input().strip()
T=input().strip()
s=[]
t=[]
for i in range(len(S)):
  s.append(str(S[i]))
for i in range(len(T)):
  t.append(str(T[i]))

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

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

Solution (Python):

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

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

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

sList = []
for index in range(0,len(s)):
    sList.append(s[index])

tList = []
for index in range(0,len(t)):
    tList.append(t[index])

sList.sort()
tList.sort()
tList.reverse()

newS = ""
for word in sList:
    newS = newS + word

newT = ""
for word in tList:
    newT = newT + word

list = [newS, newT]
list.sort()

if list[0] == list[1]:
    print("No")
elif list[0] == newS:
    print("Yes")
else:
    print("No")

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

Solution (Python):



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

print "Yes" if A < B else "No"

Solution (Python):
import math

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

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

Solution (Python):
S = input()
T = input()
num = 0
S = sorted(S)
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')

Solution (Python):
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
  if len(sd)<len(td) and sd[len(sd)-1]==td[len(sd)-1]:
    print("Yes")
    return
  print("No")

main()

Solution (Python):


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:
    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")

Solution (Python):
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 s]))
    t = ''.join(sorted([c for c in t], reverse=True))
    if s < t:
        return 'Yes'

    return 'No'



print(main())

Solution (Python):



import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
s = "".join(sorted(s))
t = "".join(sorted(t, reverse=True))
if s < t:
    print("Yes")
else:
    print("No")

Solution (Python):

import sys

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

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

list_s = list(s)
list_s.sort()

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

yes = False
if len(list_s) < len(list_t):
    yes = True

for i in range(len(list_s)):
    if len(list_t)-1 < i:
        break
    if list_s[i] < list_t[i]:
        yes = True
        break
    elif list_s[i] > list_t[i]:
        yes = False
        break

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

Solution (Python):
S = list(sorted(input()))
T = list(reversed(sorted(input())))

print('Yes' if S < T else 'No')

Solution (Python):
S = input()
T = input()

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

if __name__ == '__main__':
    main()

Solution (Python):
S = input()
T = input()

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

if __name__ == '__main__':
    main()

Solution (Python):
s=list(input());t=list(input())
s.sort(key=str);t.sort(key=str,reverse=True)
print(['No','Yes'][t>s])

Solution (Python):
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce
from operator import xor
from heapq import heappush, heappop
INF = float("inf")
sys.setrecursionlimit(10**7)


dy4, dx4 = [0, -1, 0, 1], [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


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

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

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

if __name__ == '__main__':
    main()

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

    sList, tList = list(s), list(t)

    sList.sort()
    tList.sort(reverse=True)

    sortedS = ''.join(sList)
    sortedT = ''.join(tList)

    if sortedS < sortedT:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):
s=str(input())
t=str(input())
s2=sorted(list(s))
t2=sorted(list(t),reverse=True)

s3=''.join(s2)
t3=''.join(t2)

if s3 < t3:
    print('Yes')
else:
    print('No')

Solution (Python):
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)

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

Solution (Python):
print("Yes"*(sorted(input())<sorted(input())[::-1])or"No")

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

Solution (Python):
print "Yes" if sorted(raw_input())<[x for x in reversed(sorted(raw_input()))] else "No"

Solution (Python):
ss = list(map(ord, input().strip()))
ts = list(map(ord, input().strip()))

bigger = False
non_empty = False
while len(ts) > 0 and len(ss) > 0:
    s = min(ss)
    t = max(ts)
    if s == t:
        ts.remove(t)
        ss.remove(s)
    elif s > t:
        bigger = False
        non_empty = True
        break
    else:
        bigger = True
        non_empty = True
        break

if not non_empty:
    if len(ts) == 0 and len(ss) == 0:
        bigger = False
    elif len(ss) == 0:
        bigger = True
    else:
        bigger = False

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

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

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

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

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

Solution (Python):
import math
a = input()
b = input()

res = "".join(sorted(a)) < "".join(reversed(sorted(b)))
print("Yes" if res else "No")

Solution (Python):
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')
elif(len(s) > len(t) and s[:len(t):] == 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

Solution (Python):

import math

s = input()
t = input()


s_list = list(s)
s_list.sort()

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

count = min(len(s_list), len(t_list))
for i in range(count):
    if s_list[i] < t_list[i]:
        print("Yes")
        exit()
    elif s_list[i] == t_list[i]:
        continue
    else:
        print("No")
        exit()

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

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

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

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

Solution (Python):
sl = [input() for i in range(2)]

if ''.join(sorted(sl[0])) < ''.join(sorted(sl[1]))[::-1]:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
s=input()
t=input()
print("Yes"if"".join(sorted(s))<"".join(reversed(sorted(t)))else"No")

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

Solution (Python):
s = sorted(input())
t = sorted(input())
t.reverse()

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

Solution (Python):
print ['No', 'Yes'][sorted(raw_input()) < sorted(raw_input(), reverse=True)]

Solution (Python):
sl = [input() for i in range(2)]

s = [s_ for s_ in sl[0]]
s.sort()

t = [t_ for t_ in sl[1]]
t.sort()
t = t[::-1]

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

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

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

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

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

Solution (Python):
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(reverse=True)

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

if len(tn) > len(sn):
    print('Yes')
else:
    print('No')

Solution (Python):

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

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

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

Solution (Python):
print('Yes'if sorted(input())<sorted(input(),reverse=1)else'No')

Solution (Python):
from collections import Counter
s = raw_input()
t = raw_input()

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

for x in xrange(min(len(s), len(t))):
    if s < t:
        print "Yes"
        break
    elif s>t:
        print "No"
        break
else:
    if len(s) < len(t):
        print "Yes"
    else:
        print "No"

Solution (Python):
from collections import defaultdict

def get_alphadic(string):
    dic = defaultdict(lambda: 0)
    for c in string:
        dic[c] += 1
    return dic


def get_newstring(dic):
    string = ''
    for item in sorted(dic.items(), key=lambda x: x[0]):
        string += item[0]*item[1]
    return string


def main():
    s = input()
    t = input()
    s_dic = get_alphadic(s)
    t_dic = get_alphadic(t)
    s_ = get_newstring(s_dic)
    t_ = get_newstring(t_dic)[::-1]

    if s_ < t_:
        print('Yes')
    else:
        print('No')



if __name__ == '__main__':
    main()

Solution (Python):


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

Solution (Python):
s=list(str(input().rstrip()))
t=list(str(input().rstrip()))
s.sort()
t.sort(reverse=1)
if s<t:print("Yes")
else: print("No")

Solution (Python):

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

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

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

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

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

if s_2 < t_2 :
    print("Yes")
else:
    print("No")

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

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

if s_asc < t_dsc:
    print('Yes')
else:
    print('No')

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

s_sorted = sorted(s)
t_sorted = sorted(t, reverse=True)

result = 0
score = 0
for s_al, t_al in zip(s_sorted, t_sorted):
    if s_al > t_al:
        result = -1
        break
    elif s_al < t_al:
        result = 1
        break
if result == 0:
    result = -1 if len(s) >= len(t) else 1

print("Yes" if result == 1 else "No")

Solution (Python):
S = list(input())
T = list(input())
S.sort()
T.sort()
T=T[::-1]

S=''.join(S)
T=''.join(T)

if(S<T):
	print('Yes')
else:
	print('No')

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

alphabet = [chr(i) for i in range(97, 97+26)]


def max_s(s):
    for c in alphabet:
        if c in s:
            return c


def min_s(s):
    for c in reversed(alphabet):
        if c in s:
            return c


def compare(s1, s2):
    s1_index = alphabet.index(s1)
    s2_index = alphabet.index(s2)
    return s1_index < s2_index


for i in range(max(len(s), len(t))):
    if len(s) == 0:
        print("Yes")
        break
    elif len(t) == 0:
        print("No")
        break

    s_max = max_s(s)
    t_min = min_s(t)

    if s_max == t_min:
        s = s[:s.find(s_max)] + s[s.find(s_max) + 1:]
        t = t[:t.find(t_min)] + t[t.find(t_min) + 1:]
        continue

    if compare(s_max, t_min):
        print("Yes")
        break
    else:
        print("No")
        break
else:
    print("No")

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

Solution (Python):
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 = "".join(a)
b = "".join(b)
if a <  b :
  print("Yes")
else:
  print("No")

Solution (Python):
s = input()
s_sort = sorted(s)
 
t = input()
t_sort = sorted(t, reverse=True)
 
if s_sort < t_sort:
    print('Yes')
else:
    print('No')

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

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


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

Solution (Python):

def main():
    s = raw_input()
    t = raw_input()
    
    if min(s) <  max(t):
        print "Yes"
    elif s.count(s[0]) == len(s) and t.count(t[0]) == len(t) and len(s) < len(t):
        print "Yes"
    else:
        print "No"

if __name__=="__main__":
    main()

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

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

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

if(len(s)<=len(t)):
    l = len(s)
else:
    l = len(t)

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

if(P==l):
    if(len(s)<len(t)):
        R=0
    else:
        R=1

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

Solution (Python):
i,s=input,sorted;print(["No","Yes"]["".join(s(i()))<"".join(s(i()))[::-1]])

Solution (Python):
print(["No","Yes"]["".join(sorted(input()))<"".join(sorted(input()))[::-1]])

Solution (Python):
print(["No","Yes"]["".join(sorted(input()))<"".join(reversed(sorted(input())))])

Solution (Python):
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 and len(b) > 0:
    i = 0
    b = "".join( sorted( list(b), 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"