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 in C (GCC 5.4.1) (judge verdict: Accepted)


#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define c_cin(X) scanf("%c",&X);
#define ll_cin(X) scanf("%lld", &X)
#define ull_cin(X) scanf("%llu", &X)
#define lf_cin(X) scanf("%lf", &X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  s_coutc(X) printf("%s",X)

#define  c_cout(X) printf("%c",X)


#define  ll_cout(X) printf("%lld\n",X)
#define  ull_cout(X) printf("%llu\n",X)



typedef long long  ll;
typedef unsigned long long  ull;

#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);


int s_asorts(const void* a, const void* b);
int s_dsorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsorts(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535      
#define deg_rad(X)  (X*(M_PI/180))

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion





//ABC 95-C Half and Half
//int main(void) {
//	long  a, b, c, x, y;
//	long tmp;
//	scanf("%ld %ld %ld %ld %ld", &a, &b, &c, &x, &y);
//	c *= 2;
//
//	/*if (a >= c) {
//		tmp=(long)x * c + ((y - x < 0) ? 0 :(long)(y - x) * b);
//		printf("%ld",tmp);
//		return 0;
//	}
//	if (b >= c) {
//		tmp =(long)y * c + ((x - y < 0) ? 0 : (long)(x - y) * b);
//	    printf("%ld\n", tmp);
//		return 0;
//	}*/
//
//	if ((a + b) <= c) {
//	     printf("%ld\n",a * x + b * y);
//	     return 0;
//	}
//	
//	tmp = a * x + b * y;
//	if (c * _max(x, y) < tmp) {
//		printf("%ld\n",c* _max(x, y)); return 0;
//	}
//
//	tmp = c * _min(x, y);
//	tmp += ((x < y) ? (y - x) * b :(x - y) * a);
//	printf("%ld\n", tmp);
//	return 0;
//}
	
// ABC082-B Two Anagrams

int main(void) {
	char s[101], t[101];
	int  sl, tl,len;
	memset(s, 0x00, sizeof(s));
	memset(t, 0x00, sizeof(t));

	s_cin(s); sl = strlen(s); s[sl] = 0x00;
	s_cin(t); tl = strlen(t); t[tl] = 0x00;
	 
	qsort(s, sl, sizeof(char), s_asorts);
	qsort(t, tl, sizeof(char), s_dsorts);

	if (strcmp(s, t) < 0)
		s_cout("Yes");
	else
	    s_cout("No");

	return 0;

}


// 162 D-RGB Triplets
//static char s[4001];
//static int  r[4000], g[4000], b[4000];
//int main(void)
//{
//	int n, i, j;
//	long cnt = 0;
//	int  rp = 0, gp = 0, bp = 0;
//
//	i_cin(n);
//	s_cin(s);

	//for (i = 0; i < n; i++) {
	//	switch(s[i]) {
	//	case'R':
	//		r[rp] = i; rp++; break;
	//	case 'G':
	//		g[gp] = i; gp++; break;
	//	case 'B':
	//		b[bp] = i; bp++; break;
	//	}
	//}
	//
	////RBG R BG
	//printf("\n r:%d g:%d b:%d %ld", rp, gp, bp,rp*gp*bp);
	//printf("\n"); for (i = 0; i < rp; i++)  printf("%d ",r[i]);
	//printf("\n"); for (i = 0; i < gp; i++) printf("%d ",g[i]);
	//printf("\n"); for (i = 0; i < bp; i++) printf("%d ",b[i]);

	//for (i = 0; i < rp; i++) {
	//	for (j = 0; j < gp; j++) {
	//		if (g[j] < r[i]) continue;
	//		int rg;
	//		rg = g[j] - r[i];
	//		for (int k = 0; k < bp; k++) {
	//			if (b[k] < g[j])continue;
	//			if (rg == b[k] - g[j]) continue;
	//			cnt++;

	//		}
	//	}
	//}
//
//	l_cout(cnt);
//	return 0;
//}
//066-B

//157-C
//int main(void) {
//	int n, m;
//	int s, c;
//	int a[3] = { -1,-1,-1 };
//	int i, ans=0;
//	
//	i_cin2(n, m);
//
//	if  (m == 0 && n!=1) { i_cout(-1); return 0; } //???2つ目の条件なし
//
//	for (i = 0; i < m; i++) {
//		i_cin2(s, c);
//		if ((a[s - 1] != -1) &&   //矛盾はないか
//			(a[s - 1] != c)  ) { i_cout(-1); return 0; }
//		switch (n) {
//		case 1:if (s != 3) { i_cout(-1); return 0; } 
//			   break;
//		case 2:if (s == 1) { i_cout(-1); return 0; }
//			  if (s == 2 && c == 0)
//			  {i_cout(-1); return 0;}
//			  break;
//		case 3:
//			if (s == 1 && c == 0)
//			{i_cout(-1); return 0;}
//			break;
//		}
//		a[s - 1] = c;
//	}
//
//	for (i = 0; i < 3; i++) {
//		if (a[i] == -1) a[i] = 0;
//	}
//	ans = a[0] * 100 + a[1] * 10 + a[2];
//
//	i_cout(ans);
//	return 0;
//}