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

Solution code:
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
sa = ''.join(sorted(s))
ts = ''.join(sorted(t,reverse=True))
ans = 'No'
for i in range(len(s)):
  if ord(sa[i]) < ord(ts[i]):
   ans = 'Yes'
   break
  elif sa[i] == ts[i]:
    if len(s) == i+1:
      if len(t) > len(s):
       ans = 'Yes'
      
  else:
   continue

print(ans)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<string>
using namespace std;
int main(){
  string a,b;
  cin>>a>>b;
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  if(a<b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
    }

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=input()
t=input()
S=list(s)
T=list(t)
S.sort()
T.sort()
T.reverse()
s=str(S)
t=str(T)



i=0
a=False
for wer in range( len(S) ):
    if S[i]<T[i]:
        a=True
        break
    i+=1
   

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

Submission status: Runtime Error

Solution code:
s=input()
t=input()
S=list(s)
T=list(t)
S.sort()
T.sort()
T.reverse()
s=str(S)
t=str(T)


a=True

for i in range(10):
    if s[i]>t[i]:
        a=False


if a: print("Yes")

Submission status: Runtime Error

Solution code:
s=input()
t=input()
S=list(s)
T=list(t)
S.sort()
T.sort()
T.reverse()
s=str(S)
t=str(T)
for char in S:
    print(char,end="")
print()
for char in T:
    print(char,end="")
print()

a=True

for i in range(10):
    if s[i]>t[i]:
        a=False


if a: print("Yes")

Submission status: Runtime Error

Solution code:
import string


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

L = list(string.ascii_lowercase)

S = [L.index(s) for s in S]
T = [L.index(t) for t in T]

S.sort()
T.sort()
T.reverse()

while True:
    if len(S) == 0:
        if len(T) > 0:
            print('Yes')
            break
        else:
            print('No')
            break
    s = S[0]
    t = T[0]
    if s < t:
        print('Yes')
        break
    elif s == t:
        del S[0]
        del T[0]
    else:
        print('No')
        break

Submission status: Runtime Error

Solution code:
S = list(input())
T = list(input())
S = sorted(S)
T = sorted(T,reverse = True)
counter = 0
for i in range(len(S)) :
    if S[i] > T[i] :
        print("No")
        break
    elif S[i] < T[i] :
        print("Yes")
        break
    else :
        counter += 1
    if counter == len(S) :
        if len(S) >= len(T) :
            print("No")
            break
        else :
            print("Yes")
            break

Submission status: Runtime Error

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

if len(s) < len(t):
    for i in range(len(s)):
        if ord(s[i]) > ord(t[i]):
            break
    jud = True
else:
    for i in range(len(s)):
        count = 0
        if ord(s[i]) < ord(t[i]):
            count += 1
        elif ord(s[i]) > ord(t[i]):
            break
    if count >= 1:
        jud = True

print('Yes' if jud == True else 'No')

Submission status: Runtime Error

Solution code:
s = sorted(input())
t = sorted(input(), reverse=True)
len_s = len(s)
len_t = len(t)
n_passed = 0

for i in range(len_s):
    if s[i] < t[i]:
        print("Yes")
        exit()

t = sorted(t)
if len_s < len_t:
    for i in range(len_s):
        if s[i] == t[i]:
            n_passed += 1
    if n_passed == len_s:
        print("Yes")
        exit()
print("No")

Submission status: Runtime Error

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

r = len(s) if len(s) < len(t) else len(t)
for i in range(0, r):
    if (not s or not t):
        break
    if s.pop(i) == t.pop(i):
        continue
    elif s.pop(i) < t.pop(i):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
print("Yes") if len(s) < len(t) else print("No")

Submission status: Runtime Error

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

r = len(s) if len(s) < len(t) else len(t)
for i in range(0, r):
    if s.pop(i) == t.pop(i):
        continue
    elif s.pop(i) < t.pop(i):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
print("Yes") if len(s) < len(t) else print("No")

Submission status: Runtime Error

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

r = len(s) if len(s) < len(t) else len(t)
for i in range(0, r-1):
    if s.pop(i) == t.pop(i):
        continue
    elif s.pop(i) < t.pop(i):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
print("Yes") if len(s) < len(t) else print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
t=input()
s.sort()
T=t.sort()[::-1]
L=sort([s,T])

if s==T:
  print('No')
else:
  if L[0]==s:
    print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
s = input()
t = input()
Alphabet = []
Alphabet.append("a")
Alphabet.append("b")
Alphabet.append("c")
Alphabet.append("d")
Alphabet.append("e")
Alphabet.append("f")
Alphabet.append("g")
Alphabet.append("h")
Alphabet.append("i")
Alphabet.append("j")
Alphabet.append("k")
Alphabet.append("l")
Alphabet.append("m")
Alphabet.append("n")
Alphabet.append("o")
Alphabet.append("p")
Alphabet.append("q")
Alphabet.append("r")
Alphabet.append("s")
Alphabet.append("t")
Alphabet.append("u")
Alphabet.append("v")
Alphabet.append("w")
Alphabet.append("x")
Alphabet.append("y")
Alphabet.append("z")
flag = 0
S = sorted(s)
T = sorted(t,reverse = True)
for i in range(len(S)) :
    if S[i] == T[i] :
        flag += 1
    else :
        for j in range(len(Alphabet)) :
            if S[i] == Alphabet[j] :
                print("Yes")
                flag += -10000
                break
            elif T[i] == Alphabet[j] :
                print("No")
                flag += -10000
                break
            else :
                continue
        break
if flag == len(S) :
    if s != t :
        print("Yes")
    else :
        print("No")

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
 
p = s.sort()
q = t.sort()
r = q.reverse()
 
if (p < r):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
s=sorted;print(['No','Yes'][s(input())<s(input())[-1]])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

ans = "No"
for i in range(len(sd)):
    if td[i] > sd[i]:
        ans = "Yes"
        break
    elif td[i] == sd[i]:
        pass
    else:
        break;

print(ans)

Submission status: Runtime Error

Solution code:
a="".join(list(sorted(input())))
b="".join(list(sorted(input()))[::-1])
u=list(sorted(a,b))
if u[0]==a:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a="".join(sorted(input()))
b="".join(sorted(input())[::-1])
u=sorted(a,b)
if u[0]==a:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
s1 = input()
s2 = input()

s1.sort()
s2.sort()
s2 = s2[::-1]

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

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main(){
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),greater<>());
    if(s<t)puts("Yes");
    else puts("No");
    return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import random

def main():
    s = list(input())
    t = list(input())
    # randomize
    random.shuffle(s)
    random.shuffle(t)
    s_chr = "".join(s)
    t_chr = "".join(t)

    flag = 0
    if len(s_chr) < len(t_chr):
        max_len = len(s_chr)
    elif len(t_chr)>len(s_chr):
        max_len = len(t_chr) 
    else:
        max_len = len(s_chr)
        flag = 1

    # small dake mawasu 
    for count in range(max_len):
        if s_chr[count] < t_chr[count]:
            break
        else:
            pass

    if s_chr[count] < t_chr[count]:
        print("YES")
    elif s_chr[count] == t_chr[count] and flag==0 and count+2!=max_len:
        print("YES")

    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
length = len(first) < len(second)

result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if !check_equal:
    result = (f < s)
    break

if (length and check_equal) or result:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
s=sorted(input())
t=sorted(input(),reverse=True)
if s==t:
	print("No")
    exit()
a=sorted([s,t])
if a[0]==s:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
print(["No", "Yes"][s.sort()<t.sort()[::-1]])

Submission status: Runtime Error

Solution code:
s = list(input())
s.sort()

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

if s == t:
    print('No')
else:
    j = 0
    for i in s:
        if i < t[j]:
            print('Yes')
            break

        if i > t[j]:
            print('No')
            break
        j += 1

Submission status: Runtime Error

Solution code:
from itertools import zip_longest

def twoAnagrams(s, t):
    s_str = ''.join(sorted(s))
    t_str = ''.join(sorted(t, reverse=True))

    if t_str.startswith(s_str):
        if len(s_str) < len(t_str):
            return True
        # this implies s and t is the same string
        else:
            return False

    for s_chr,t_chr in zip_longest(s_str, t_str):
        if s_chr is None:
            return True
        elif t_chr is None or t_chr < s_chr:
            return False
        else s_chr < t_chr:
            return True


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

print('Yes' if twoAnagrams(s,t) else 'No')

Submission status: Runtime Error

Solution code:
from itertools import zip_longest

def twoAnagrams(s, t):
    s_str = ''.join(sorted(s))
    t_str = ''.join(sorted(t, reverse=True))

    if t_str.startswith(s_str):
        if len(s_str) < len(t_str):
            return True
        # this implies s and t is the same string
        else:
            return False

    for s_chr,t_chr in zip_longest(s_str, t_str):
        if s_chr is None or s_chr < t_chr:
            return True
        elif t_chr is None or t_chr < s_chr:
            return False


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

print('Yes' if twoAnagrams(s,t) else 'No')

Submission status: Runtime Error

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

ss = list(s)
tt = list(input())

ss.sort()
tt.sort(reverse=True)

s1 = ''.join(ss)
t1 = ''.join(tt)

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

Submission status: Runtime Error

Solution code:
s = input()
t = input()
slist,tlist = [],[]
for i in s:
	slist.append(i)
for i in t:
	tlist.append(i)
slist.sort()
tlist.sort()
tlist = tlist[::-1]
for j in range(min(len(slist),len(tlist))):
	if ord(slist[j]) < ord(tlist[j]):
		print("Yes")
		break
	elif ord(slist[j]) > ord(tlist(j)):
		print("No")
		break
	else:
		if j == min(len(slist),len(tlist))-1:
			if len(slist) < len(tlist): print("Yes")
			else: print("No")

Submission status: Runtime Error

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

if len(s)==len(t) or len(s) > len(y):
	if s < t:
		print("Yes")
	else:
		print("No")
elif len(s) < len(t):
	if s < t or s == t:
		print("Yes")
	else:
		print("No")
else:
	print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
s=input()
t=input()
s=sorted(list(s))
t=sorted(list(t))[::-1]
sum=0
for i in range(len(s)):
    if ord(s[i])<ord(t[i]):
        print("Yes")
        sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
import sys
s=input()
t=input()
s=sorted(list(s))
t=sorted(list(t))[::-1]
sum=0
for i in range(len(s)):
    if chr(s[i])<chr(s[t]):
        print("Yes")
        sys.exit()
print("No")

Submission status: Runtime Error

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

a.sort()
b.sort()

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

Submission status: Runtime Error

Solution code:
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.reverse()
for i in range(len(a)):
    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")

Submission status: Runtime Error

Solution code:
import sys

a=input()
b=input()
"""
if(len(a)>len(b)):
    print("Yes")
    sys.exit()
elif(len(a)<len(b)):
    print("No")
    sys.exit()
else:
"""
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.reverse()
for i in range(len(a)):
    if(c[i]<d[i]):
        print("Yes")
        sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
N = len(s)
M = len(t)
s.sort()
t.reverse()
if N < M and s == t[:N]:
    print("Yes")
else:
    for i in range(N):
        if s[i] < t[i]:
            print("Yes")
            break
    else:
        print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


int main()
{
	string s, t;
	int i, j;
	char tmp;
	
	cin >> s >> t;

	for(i = 0; i < s.size() - 1; i++){
		for(j = i + 1; j < s.size(); j++){
			if(s[i] > s[j]){
				tmp = s[j];
				s[j] = s[i];
				s[i] = tmp;
			}
		}
	}
	for(i = 0; i < t.size() - 1; i++){
		for(j = i + 1; j < t.size(); j++){
			if(t[i] < t[j]){
				tmp = t[j];
				t[j] = t[i];
				t[i] = tmp;
			}
		}
	}

	for(i = 0; i < min(s.size(), t.size()); i++){
		if(s[i] < t[i]){
			cout << "Yes" << endl;
			return 0;
		}
		else if(s[i] > t[i]){
			cout << "No" << endl;
			return 0;
		}
	}

	if(s.size() < t.size()){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

Submission status: Runtime Error

Solution code:
s = list(input().strip())
s.sort()
t = list(input())
t.reverse()
a = [chr(i) for i in range(97, 97+26)]
cnt = 0
for i in range(len(s)):
  if a.index(s[i]) < a.index(t[i]):
    print("Yes")
    break
  elif a.index(s[i]) > a.index(t[i]):
    print("No")
    break
  elif a.index(s[i]) == a.index(t[i]):
    cnt += 1
    
if cnt == len(s):
  if cnt < len(t):
    print("Yes")
  elif cnt == len(t):
    print("No")

Submission status: Runtime Error

Solution code:
import math

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

Submission status: Runtime Error

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

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

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

if len(s)  == len(t):
    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: Runtime Error

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

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

if len(s)  == len(t):
    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")
            ccondition =1
            break
        else:
            print("No")
            condition =1
            break
    if condition == 0:
        print("No")

Submission status: Runtime Error

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

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

if len(s)  == len(t):
    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")
            ccondition =1
            break
        else:
            print("No")
            condition =1
            break
    if condition == 0:
        print("No")

Submission status: Runtime Error

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

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

if len(s)  == len(t):
    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
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")
            ccondition =1
            break
        else:
            print("No")
            condition =1
            break
    if condition == 0:
        print("No")

Submission status: Runtime Error

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

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")
            quit()
        else:
            print("No")
            quit()
elif pattern == 0:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] > t[i]:
            print("Yes")
            quit()
        else:
            print("No")
            quit()
    print("Yes")
elif pattern == 1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] > t[i]:
            print("Yes")
            quit()
        else:
            print("No")
            quit()
    print("No")

Submission status: Runtime Error

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

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

if len(s)  == len(t):
    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")
            quit()
        else:
            print("No")
            quit()
elif pattern == 0:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] > t[i]:
            print("Yes")
            quit()
        else:
            print("No")
            quit()
    print("Yes")
elif pattern == 1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] > t[i]:
            print("Yes")
            quit()
        else:
            print("No")
            quit()
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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(b), 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: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
ss=''+join(sorted(ss))
tt=''+join(sorted(tt,reverse=true))
if ss<tt:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

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

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

import math

def slove(s, t):
    if s == t:
        return "No"
    while (True):
        if min(s) == max(t):
            s.remove(min(s))
            t.remove(max(t))
        else:
             break

        if len(s) == 0:
             return "Yes"

    if min(s) < max(t):
        return "Yes"
    return "No"

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