// Problem: C - Airport Code
// Contest: AtCoder - AtCoder Beginner Contest 349
// URL: https://atcoder.jp/contests/abc349/tasks/abc349_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
/*Code by Leo2011*/
#include <bits/stdc++.h>
#define log printf
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define FOR(i, l, r) for (int(i) = (l); (i) <= (r); ++(i))
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(nullptr); \
cout.tie(nullptr);
using namespace std;
typedef __int128 i128;
typedef long long ll;
typedef pair<int, int> PII;
int len, sum;
unordered_map<char, int> mp;
string s, s2;
template <typename T>
inline T read() {
T sum = 0, fl = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') fl = -1;
for (; isdigit(ch); ch = getchar()) sum = sum * 10 + ch - '0';
return sum * fl;
}
template <typename T>
inline void write(T x) {
if (x < 0) putchar('-'), x = -x;
static T sta[35];
int top = 0;
do { sta[top++] = x % 10, x /= 10; } while (x);
while (top) putchar(sta[--top] + 48);
}
bool chk(string s, string t) {
if (s.size() == 0) return 1;
string::iterator its = s.begin();
string::iterator itt = t.begin();
while (itt != t.end()) {
if (*its == *itt) its++;
if (its == s.end()) return 1;
itt++;
}
return 0;
}
int main() {
IOS cin >> s >> s2;
len = s.size() - 1;
FOR(i, 0, 2) s2[i] += 32;
FOR(i, 0, len)++ mp[s[i]];
FOR(i, 0, 2) if (mp[s2[i]] > 0)-- mp[s2[i]], ++sum;
if ((sum == 3 && chk(s2, s)) || (sum == 2 && s2[2] == 'x')) {
if (sum == 2) {
s2.erase(2);
if (chk(s2, s)) putchar('Y'), putchar('e'), putchar('s');
else putchar('N'), putchar('o');
} else putchar('Y'), putchar('e'), putchar('s');
} else putchar('N'), putchar('o');
return 0;
}
AC47,WA1寄……