#include<bits/stdc++.h>
#define N 1005
using namespace std;
string str;
int useds[N],usedt[N];

bool check(string s,string t){
  int x=0,y=0,idx=0,len=str.size();
  memset(useds,0,sizeof(useds));
  memset(usedt,0,sizeof(usedt));
  while(1){
    while(x<len&&(s[x]!=str[idx]||useds[x]))x++;
    if(x==len)break;
    idx++;
    if(idx==len)return true;
    useds[x]=true;
    while(y<len&&(t[y]!=str[idx]||usedt[y]))y++;
    if(y==len)break;
    idx++;
    if(idx==len)return true;
    usedt[y]=true;
  }
  return false;
}
 
int main(){
  string s,t;
  cin>>s>>t;
  str=s;
  if(check(s,t)||check(t,s))
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}