jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let ans=0
  rep(4,()=>{
    if(ssin()=='+')ans++
    else ans--
  })
  out(ans)
}
main();
//  [typescript]

const Main = (ary: string): void => {
	const input = ary.split("")
	let ret = 0
	for (let i = 0; i < input.length; i++) {
		if (input[i] === "+") {
			ret++
		} else if (input[i] === "-") {
			ret--
		}
	}
	console.log(ret)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let ans=0
  rep(4,()=>{
    if(sin()=='+')ans++
    else ans--
  })
  out(ans)
}
main();
//  [typescript]
const main = (input) => {
  input = input.trim();
  input = input.split('');
  const a = input[0];
  const b = input[1];
  const c = input[2];
  const d = input[3];
  const s = a+b+c+d;
  
  if(s=="+---"){
    console.log(-2);
  }else if(s=="+++-"){
    console.log(2);
  }else if(s=="++++"){
    console.log(4);
  }else if(s=="----"){
    console.log(-4);
  }else{
    console.log(0);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const main = (input: void) => {
  const s: string = input;
  let cnt: number = 0;

  for (let i=0; i < s.length; i++) {
    if (s.split('')[i] === '+') {
      cnt++;
    } else {
      cnt--;
    }
  }
  console.log(cnt);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
S=input()
T=input()
s=[str(a) for a in S]
t=[str(b) for b in T]
s.sort()
t.sort(reverse=True)
s=''.join(s)
t=''.join(t)
if s<t:
  print ("Yes")
else:
  print("No")
//  [python]
s = "".join(sorted(input()))
t = "".join(sorted((input()))[::-1])
if s < t:
    print("Yes")
else:
    print("No")
//  [python]
val = sorted(input())
val2 = sorted(input(),reverse=True)
print("Yes" if val2 > val else "No")
//  [python]
s = list(input())
t = list(input())

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

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

print("Yes" if s<t else "No")
//  [python]
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

if s < t:
    print('Yes')
else:
    print('No')
//  [python]
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

if s < t:
    print('Yes')
else:
    print('No')
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		String s = sc.next();
		String t = sc.next();
		char[] a = s.toCharArray();
		char[] b = t.toCharArray();
		Arrays.sort(a);
		Arrays.sort(b);
		char[] c = new char[b.length];
		for (int i = 0; i < b.length; i++)
			c[i] = b[b.length - 1 - i];

		for (int i = 0; i < Math.min(a.length, c.length); i++) {
			if (a[i] < c[i]) {
				System.out.println("Yes");
				return;
			} else if (a[i] > c[i]) {
				System.out.println("No");
				return;
			}
		}
		if (a.length < c.length)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        char[] s = input.readLine().toCharArray();
        char[] t = input.readLine().toCharArray();
        Arrays.sort(s);
        Arrays.sort(t);
        for (int i = 0, j = t.length - 1; i < s.length && j > -1; i++, j--) {
            if (s[i] < t[j]) {
                System.out.println("Yes");
                return;
            } else if (s[i] > t[j]) {
                System.out.println("No");
                return;
            }
        }
        if (s.length < t.length) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
//  [java]
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();  
        String s = r.s();
        String t = r.s();
        char[] sc = s.toCharArray();
        char[] tc = t.toCharArray();
        Arrays.sort(sc);
        Arrays.sort(tc);
        char[] temp = new char[tc.length];
        for(int i = 0; i < tc.length; i++)
            temp[i] = tc[tc.length-1-i];
        tc = temp;
        s = new String(sc);
        t = new String(tc);
        println(s.compareTo(t) < 0 ? "Yes" : "No");
    }
    static class EdgeList{
        int id;
        ArrayList<int[]> list = new ArrayList<>();
        int d;
        EdgeList(int n){
            id = n;
        }
        void add(int[] a){
            list.add(a);
        }
        int size(){
            return list.size();
        }
        void setD(int d){
            this.d = d;
        }
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}
//  [java]
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			String s = scan.next();
			Character[]S = new Character[s.length()];
			for(int i = 0;i<s.length();i++) {
				S[i] = s.charAt(i);
			}

			Arrays.sort(S);


			String t = scan.next();
			Character[]T = new Character[t.length()];
			for(int i = 0;i<t.length();i++) {
				T[i] = t.charAt(i);
			}

			Arrays.sort(T,Collections.reverseOrder());


			/*
			for(int i = 0;i<S.length;i++)System.out.print(S[i]);
			System.out.println();
			for(int i = 0;i<T.length;i++)System.out.print(T[i]);
			*/



			int ok = 1;
			int i = 0;
			while(true) {
				if(S[i]==T[i]) {
					i++;
					if(i==S.length)break;
				}else if(S[i]<T[i]) {
					break;
				}else {
					ok=0;
					break;

				}
			}

			if(ok==0) {
				System.out.println("No");
			}else {
				if(i==S.length) {
					if(S.length<T.length) {
						System.out.println("Yes");
					}else {
						System.out.println("No");
					}

				}else {
					System.out.println("Yes");
				}

			}








		}


	}


}
//  [java]
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<String> s = nextCharArray();
      ArrayList<String> t = nextCharArray();
      Collections.sort(s);
      Collections.sort(t, Comparator.reverseOrder());
      String ns = myconv(s, 0);
      String nt = myconv(t, 0);
      myout((ns.compareTo(nt) == -1) ? "Yes" : "No");
	}
	//Method addition frame start



	//Method addition frame end
}
//  [java]
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String t = sc.next();
    String ss[] = s.split("");
    String tt[] = t.split("");
    Arrays.sort(ss);
    Arrays.sort(tt);
    s = String.join("",ss);
    t = String.join("",tt);
    int n = Math.min(s.length(),t.length());
    String ans = "No";
    int c = 0;
    for(int i = 1 ; i <= n ; ++i){
      if((int)s.charAt(0)<(int)t.charAt(t.length()-i)){
        ans = "Yes";
        break;
      }else if((int)s.charAt(0)==(int)t.charAt(t.length()-i)){
        c++;
      }
    }
    
    if(c==n && s.length()<t.length()) ans ="Yes";
    
    System.out.println(ans);

  }
}
//  [cpp]
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
    char a[100],b[100];
    int f=0,i,j;
    scanf("%s",a);
    scanf("%s",b);
    sort(a,a+strlen(a));
    sort(b,b+strlen(b));
    i=0;
    j=strlen(b)-1;
    while(i<strlen(a)&&j>=0)
    {
        if(b[j]!=a[i])
        {
            if(b[j]<a[i])
                printf("No");
            else
                printf("Yes");
            f=1;
            break;
        }
        i++;
        j--;
    }
    if(!f)
    {
        if(j>=0)
            printf("Yes");
        else
            printf("No");
    }
    return 0;
}
//  [cpp]
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
bool cmp(int a,int b){
	return a>b;
}
int main() {
	char a[100],b[100];
	scanf("%s%s",a,b);
	sort(a,a+strlen(a));
	sort(b,b+strlen(b),cmp);
	if(strcmp(a,b)<0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  st s,t; ci(s>>t)
    SORT(s);
    SORT(t);
    REV(t);
  if(s<t) co("Yes")
    else co("No")
    }
//  [cpp]
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int main (void) {
	char w1[101];
	char w2[101];

	char max2 = 0, min1 = 123;

	fill(w1, w1 + 101, 0);
	fill(w2, w2 + 101, 0);
	scanf("%s %s", w1, w2);

	for (int it = 0; it < 101; ++it) {
		if (w1[it] != 0 && w1[it] < min1) min1 = w1[it];
		if (w2[it] > max2) max2 = w2[it];
	}

	if (max2 > min1) cout << "Yes\n";
	else if (strcmp(w1, w2) && strlen(w2) > strlen(w1)) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}
//  [cpp]
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int main (void) {
	char w1[101];
	char w2[101];

	char max2 = 0, min1 = 123;

	fill(w1, w1 + 101, 0);
	fill(w2, w2 + 101, 0);
	scanf("%s %s", w1, w2);

	for (int it = 0; it < 101; ++it) {
		if (w1[it] != 0 && w1[it] < min1) min1 = w1[it];
		if (w2[it] > max2) max2 = w2[it];
	}

	if (max2 > min1) cout << "Yes\n";
	else if (strcmp(w1, w2) && strlen(w2) < strlen(w1)) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
  	if(n==k){
      return 1;
    }
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// vector<vector<int>> A(3, vector<int>(4));
int main() {
    string S,T;
    cin>>S>>T;
    sort(S.begin(9,S.end());
    sort(T.rbegin(),T.rend());
    if(S<T){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}
//  [c]
#include <stdio.h>
#include <string.h>

int main() {
  char s[101] = {0}, t[101] = {0};
  int i, j;
  int sl, tl;
  scanf("%s %s", s, t);
  sl = strlen(s);
  tl = strlen(t);

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

  for (i = 0; i < tl-1; i++) {
    for (j = i+1; j < tl; j++) {
      if (t[i] < t[j]) {
        char tmp;
        tmp = t[i];
        t[i] = t[j];
        t[j] = tmp;
      }
    }
  }

  if (strcmp(s, t) < 0) {
    puts("Yes");
  }
  else{
    puts("No");
  }
  return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
//20000桁のマージソート(1単語10文字以下)
char c[101];
int sort(int a,int b,char s[101]){
  if(a==b)
    return 0;
  sort(a,(a+b)/2,s);
  sort((a+b)/2+1,b,s);
  int i=a,j=(a+b)/2+1,k=a;
  while(k<=b){
    if(i<(a+b)/2+1 && j<b+1){
      if(s[i]<s[j]){
        c[k]=s[i];
        i++;
      }
      else{
        c[k]=s[j];
        j++;
      }
    }
    else if(j>b){
      c[k]=s[i];
      i++;
    }
    else{
      c[k]=s[j];
      j++;
    }
    k++;
  }
  for(i=a;i<=b;i++)
    s[i]=c[i];
  return 0;
}

int main(){
  char s[101],t[101];
  scanf("%s%*c%s",s,t);
  int slen=strlen(s);
  int tlen=strlen(t);
  int i;
  sort(0,slen-1,s);
  sort(0,tlen-1,t);
  for(i=0;i<slen;i++){
    if(s[i]<t[tlen-1-i]){
      puts("Yes");
      return 0;
    }
    else if(s[i]>t[tlen-1-i]){
      puts("No");
      return 0;
    }
  }
  if(slen==tlen)
    puts("No");
  else
    puts("Yes");
  return 0;
}
//  [c]
// 161-C Replacing Integer

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(char*)a - *(char*)b;
}

void kojun(char* word) {
    char min_alphabet[2],tmp[2];
    int i, min_i,j;

    for (j = strlen(word) - 1; j > 0; j--) {
        min_i = 0;
        min_alphabet[0] = word[min_i];
        for (i = 1; i < j+1; i++) {
            if (word[i] < min_alphabet[0]) {
                //printf("word[i]:%c min_alphabet:%c ", word[i], min_alphabet[0]);
                min_alphabet[0] = word[i];
                min_i = i;
            }
        }
        tmp[0] = word[j];
        word[j] = word[min_i];
        word[min_i] = tmp[0];
        
        //printf("j:%d min_alphabet:%c\n", j, min_alphabet[0]);
    }
    return;
}

void syojun (char* word) {
    char max_alphabet[2], tmp[2];
    int i, max_i, j;

    for (j = strlen(word) - 1; j > 0; j--) {
        max_i = 0;
        max_alphabet[0] = word[max_i];
        for (i = 1; i < j + 1; i++) {
            if (word[i] > max_alphabet[0]) {
                //printf("word[i]:%c max_alphabet:%c ", word[i], max_alphabet[0]);
                max_alphabet[0] = word[i];
                max_i = i;
            }
        }
        tmp[0] = word[j];
        word[j] = word[max_i];
        word[max_i] = tmp[0];

        //printf("j:%d max_alphabet:%c\n", j, max_alphabet[0]);
    }
    return;
}


int main() {

    char word_s[101], word_t[101];

    scanf("%s", word_s);
    scanf("%s", word_t);
    

    syojun(word_s);
    kojun(word_t);
    //printf("%s %s\n", word_s, word_t);
    if (strcmp(word_s, word_t) < 0) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    
    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
int main(void){
  int i,j;
  char s[101],t[101];
  char b;
  int ls,lt;
  int x=0;
  
  scanf("%s",s);
  scanf("%s",t);
  
  ls=strlen(s);
  lt=strlen(t);
  
  for(i=0;i<ls;i++){
    for(j=i;j<ls;j++){
      if(s[i]>s[j]){
        b=s[i];
        s[i]=s[j];
        s[j]=b;
      }
      else{}
    }
  }
  
  for(i=0;i<lt;i++){
    for(j=i;j<lt;j++){
      if(t[i]<t[j]){
        b=t[i];
        t[i]=t[j];
        t[j]=b;
      }
      else{}
    }
  }
  
  for(i=0;i<101;i++){
    if(s[i]==t[i]){}
    if(s[i]<t[i]){
      x=1;
      break;
    }
    if(s[i]>t[i]){
      x=0;
      break;
    }
  }
  
  printf("%s\n",s);
  printf("%s\n",t);
  if(x==0)printf("No\n");
  if(x==1)printf("Yes\n");
    
  
  return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

void sort(char *s,int n)
{
        int i,j,index;
        char max;
        for(i=0;i<n;i++){
                max=s[i];index=i;
                for(j=i+1;j<n;j++){
                        if(s[j]>max){
                                max=s[j];index=j;
                        }
                }
                s[index]=s[i];s[i]=max;
        }
        return ;
}
void reverse(char *s,int n)
{
        int i,j,index;
        char max;
        for(i=0;i<n;i++){
                max=s[i];index=i;
                for(j=i+1;j<n;j++){
                        if(s[j]<max){
                                max=s[j];index=j;
                        }
                }
                s[index]=s[i];s[i]=max;
        }
        return ;
}
int main(void)
{
        int a,n,m,i,c=0,fl=0;
        char s[101],t[101];
        scanf("%s%s",s,t);
        n=strlen(s); m=strlen(t);
        sort(t,m);
        reverse(s,n);
        if(m<n)a=m;
        else a=n;
        for(i=0;i<a;i++){
                if(s[i]<t[i]){ fl=1;break;}
                else {fl=2;break;}
                c++;
        }
        if(fl==0 && n<m)fl=1;
        if(fl==0 && n>=m)fl=2;
        if(fl==1)printf("Yes\n");
        if(fl==2)printf("No\n");
        return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

void sort(char *s,int n)
{
        int i,j,index;
        char max;
        for(i=0;i<n;i++){
                max=s[i];index=i;
                for(j=i+1;j<n;j++){
                        if(s[j]>max){
                                max=s[j];index=j;
                        }
                }
                s[index]=s[i];s[i]=max;
        }
        return ;
}
void reverse(char *s,int n)
{
        int i,j,index;
        char max;
        for(i=0;i<n;i++){
                max=s[i];index=i;
                for(j=i+1;j<n;j++){
                        if(s[j]<max){
                                max=s[j];index=j;
                        }
                }
                s[index]=s[i];s[i]=max;
        }
        return ;
}
int main(void)
{
        int a,n,m,i,c=0,fl=0;
        char s[101],t[101];
        scanf("%s%s",s,t);
        n=strlen(s); m=strlen(t);
        sort(t,m);
        reverse(s,n);
        if(m<n)a=m;
        else a=n;
        for(i=0;i<a;i++){
                if(s[i]<t[i]){ fl=1;break;}
                else {fl=2;break;}
                c++;
        }
        if(fl==1 || c==a-1 && n<m)printf("Yes\n");
        else printf("No\n");
        return 0;
}
//  [javascript]
function Main(input){
	input = input.split("\n");
	var n = input[0].split("").sort().join("");
	var m = input[1].split("").sort().reverse().join("");
	console.log(n<m?"Yes":"No")
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
function compareNumbers2(a, b) { //for sort
    return b.charCodeAt()-a.charCodeAt();
}


function Main(arg) {
  var s = arg.split("\n")[0].split("");
  var t = arg.split("\n")[1].split("");

  s.sort();
  t.sort(compareNumbers2);

  if (s < t) {
    console.log("Yes");
  }
  else {
    console.log("No");
  }

  return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
    
const main = arg => {
    const s = arg.split("\n")[0].split("").sort().join("");
    const t = arg.split("\n")[1].split("").sort().reverse().join("");
    
    if(s < t) {
        console.log("Yes");   
    } else {
        console.log("No");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
const inputText = require("fs").readFileSync("/dev/stdin", "utf8").split(/\n/);
const a = inputText[0].split("").sort();
const b = inputText[1].split("").sort().reverse();

if (a < b) {
  console.log("YES");
} else {
  console.log("No");
}
//  [javascript]
( i => {
  i = i.split('\n').map((val, index) => index ? val.split('').sort().join('') : val.split('').sort().reverse().join(''));
  console.log(i[0] < i[1] ? 'Yes' : 'No')
})(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
( i => {
  i = i.split('\n').map((val, index) => index ? val.split('').sort().join('') : val.split('').sort().reverse().join(''));
  console.log(i[0] > i[1] ? 'Yes' : 'No')
})(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)

	S, T := next(), next()

	if len(S) < len(T) && S == T {
		fmt.Println("Yes")
		return
	}

	s := strings.Split(S, "")
	t := strings.Split(T, "")

	sort.Strings(s)
	sort.Strings(t)
	if len(s) < len(t) && strings.HasPrefix(strings.Join(t, ""), strings.Join(s, "")) {
		fmt.Println("Yes")
		return
	}

	sort.Sort(sort.Reverse(sort.StringSlice(t)))
	for i := 0; i < min(len(s), len(t)); i++ {
		if s[i] == t[i] {
			continue
		}
		if s[i] < t[i] {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i

}

func min(n, m int) int {
	if n <= m {
		return n
	}
	return m
}
//  [go]
package main

import (
  "fmt"
  "sort"
  "strings"
)
func main() {
  var s, t string
  fmt.Scan(&s)
  fmt.Scan(&t)

  s1 := strings.Split(s,"")
  t1 := strings.Split(t,"")

  sort.Strings(s1)
  sort.Sort(sort.Reverse(sort.StringSlice(t1)))

  s = strings.Join(s1, "")
  t = strings.Join(t1, "")

  if s < t {
    fmt.Println("Yes")
  } else {
    fmt.Println("No")
  }
}
//  [go]
package main

import (
	"fmt"
)

func Sort(s string) string {
	runes := []rune(s)
	for i := 0; i < len(runes); i++ {
		min := runes[i]
		minIndex := i
		for j := i+1; j < len(runes); j++ {
			if min > runes[j] {
				min = runes[j]
				minIndex = j
			}
		}
		tmp := runes[i]
		runes[i] = min
		runes[minIndex] = tmp
	}
	return string(runes)
}

func Reverse(t string) string {
	runes := []rune(t)
	for i := 0; i < len(runes); i++ {
		max := runes[i]
		maxIndex := i
		for j := i+1; j < len(runes); j++ {
			if max < runes[j] {
				max = runes[j]
				maxIndex = j
			}
			
		}
		tmp := runes[i]
		runes[i] = max
		runes[maxIndex] = tmp
	}
	return string(runes)
}

func main() {
	var s,t string
	fmt.Scan(&s,&t)
	
	if Sort(s) < Reverse(t) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
	
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return a
}

func main() {
	r := bufio.NewReader(os.Stdin)
	// w := bufio.NewWriter(os.Stdout)
	// defer w.Flush()
	// sc.Split(bufio.ScanWords)
	var s, t string
	fmt.Fscan(r, &s)
	fmt.Fscan(r, &t)

	ls := make([]int, 27)
	lt := make([]int, 27)

	for _, l := range s {
		ls[l-[]rune("a")[0]]++
	}
	ns := ""
	for i, l := range ls {
		ns += strings.Repeat(string(rune(i)+[]rune("a")[0]), l)
	}

	for _, l := range t {
		lt[26-(l-[]rune("a")[0])]++
	}
	nt := ""
	for i, l := range lt {
		nt += strings.Repeat(string(rune(26-i)+[]rune("a")[0]), l)
	}
	// fmt.Println(ns, nt)

	ans := "Draw"
	for i := 0; i < len(ns); i++ {
		if ns[i] == nt[i] {
			continue
		} else if ns[i] < nt[i] {
			ans = "Yes"
			break
		} else {
			ans = "No"
			break
		}
	}
	if ans == "Draw" {
		if len(ns) < len(nt) {
			ans = "Yes"
		} else {
			ans = "No"
		}
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	s, t := []byte(ReadString()), []byte(ReadString())
	sort.Slice(s, func(i, j int) bool {
		return s[i] > s[j]
	})
	sort.Slice(t, func(i, j int) bool {
		return t[i] > t[j]
	})
	a, b := string(s), string(t)
	if a < b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
//  [ruby]
s = gets.chomp.chars.sort
t = gets.chomp.chars.sort{|a, b| b <=> a}
f = false
([s.size, t.size].max).times do |i|
  if s[i].nil?
    f = true
    break
  elsif t[i].nil?
    break
  elsif s[i] > t[i]
    break
  elsif s[i] < t[i]
    f = true
    break
  end
end
puts (f ? "Yes" : "No")
//  [ruby]
s = gets.chomp.split('')
t = gets.chomp.split('')

ss = s.sort.join('')
tt = t.sort.reverse.join('')

if ss < tt
  puts 'Yes'
else
  puts 'No'
end
//  [ruby]
# https://atcoder.jp/contests/abc082/tasks/abc082_b


s = gets.chomp
t = gets.chomp
cond = s.chars.sort.join < t.chars.sort.reverse.join
puts cond ? 'Yes' : 'No'
//  [ruby]
s = gets.chomp.chars
t = gets.chomp.chars

dictionary = ('a'..'z').each_with_object({}).with_index(1) { |(char, h), i| h[char] = i }

s_dash = s.map { |char| dictionary[char] }.sort.join
t_dash = t.map { |char| dictionary[char] }.sort.reverse.join

max = [s.size, t.size].max

s_dash << '0' * (max - s.size)
t_dash << '0' * (max - t.size)

puts s_dash < t_dash ? 'Yes' : 'No'
//  [ruby]
s=gets.chomp
t=gets.chomp
if s<t
  puts :Yes
  exit
end
s.each_char do |si|
  t.each_char do |ti|
    if si>ti
      puts :Yes
      exit
    end
  end
end
puts :No
//  [ruby]
s = gets.chomp
t = gets.chomp

s.chars.sort!.join
t2 = t.chars.sort!.reverse!.join

print (s < t2) ? "Yes" : "No"
//  [rust]
#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(non_snake_case)]
fn main() {
    input![s: String, t: String];
    let mut s: Vec<_> = s.chars().collect();
    s.sort();
    let mut t: Vec<_> = t.chars().collect();
    t.sort();
    t.reverse();
    let ans = {
        if s < t {
            "Yes"
        } else {
            "No"
        }
    };
    println!("{}", ans);

}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::min;

fn main() {
    let mut s: Vec<char> = read::<String>().chars().collect();
    let mut t: Vec<char> = read::<String>().chars().collect();
    let mut ans: &str = &String::new();

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

    for i in 0..min(s.len(), t.len()) {
        if s[i] < t[i] {
            ans = &"Yes";
            break;
        }
        if s[i] > t[i] {
            ans = &"No";
            break;
        }
    }

    if ans != "" {
        println!("{}", ans);
        return;
    }

    if s.len() < t.len() {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        s: chars,
        t: chars,
    }
    let mut s = s;
    let mut t = t;
    s.sort();
    t.sort_by(|a, b| b.cmp(a));
    println!("{}", if s < t {"Yes"} else {"No"});
}
//  [rust]
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        mut s: Chars,
        mut t: Chars
    };
    s.sort();
    t.sort();
    t.reverse();
    let tf = (0..s.len()).any(|index| s[index] < t[index])
        || ((s.len() < t.len()) && (0..s.len()).all(|index| s[index] == t[index]));
    println!("{}", ["No", "Yes"][tf as usize]);
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        ss: chars,
        tt: chars,
    };
    let mut s = ss.clone();
    let mut t = tt.clone();
    s.sort();
    t.sort_by(|a, b| b.cmp(a));
    for i in 0..s.len().min(t.len()){
        if s[i] > t[i] {
            println!("No");
            return;
        }
        if s[i] < t[i] {
            println!("Yes");
            return;
        }
    }
    if s.len() >= t.len(){
        println!("No");
    } else {
        println!("Yes");
    }

}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let t: Vec<char> = read::<String>().chars().collect();

    let mins = s.iter().min();
    let maxt = t.iter().max();

    if maxt == mins {
        if s.len() == 1 && t.len() != 1 {
            println!("Yes");
        } else {
            println!("No");
        }
        return;
    }

    if maxt < mins {
        println!("No");
    } else {
        println!("Yes")
    }
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let s = readLine()!.toArray().sorted().joinWithSeparator("")
let t = readLine()!.toArray().sorted().reversed().joinWithSeparator("")
if s < t {
    print("Yes")
} else {
    print("No")
}
//  [swift]
import Foundation

let s = readLine()!.sorted().map { String($0) }.joined()
let t = readLine()!.sorted { $0 > $1 }.map { String($0) }.joined()
print(s < t ? "Yes" : "No")
//  [swift]
#if os(Linux)
    import Glibc
#else
    import Foundation
    import Darwin
#endif

#if swift(>=4.0)
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

prefix operator *
prefix func * <T> (a: [T]) -> (T, T) { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T) { return (a[0], a[1], a[2]) }
#else
func readInts() -> [Int] {
    return readLine()!.split(" ").map { Int($0)! }
}

prefix operator * {}
prefix func * <T> (a: [T]) -> (T, T) { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T) { return (a[0], a[1], a[2]) }

extension String: CollectionType {}
#endif


let s = readLine()!
let t = readLine()!

let cs = s.sorted(by: {$0 < $1}).map(String.init).joined()
let ct = t.sorted(by: {$0 > $1}).map(String.init).joined()

if cs < ct {
    print("Yes")
} else {
    print("No")
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let s = readLine()!.toArray().sorted()
let t = readLine()!.toArray().sorted().reversed()
if s < t {
    print("Yes")
} else {
    print("No")
}
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const [s, t] = stdin.split('\n')

const ans = () => {
  const sd = s.split('').sort().join('')
  const td = t.split('').sort().reverse().join('')

  console.log(sd < td ? 'Yes' : 'No')
}

ans()