#include <bits/stdc++.h>
using namespace std;
string S[2];
string s;
int p[2];
void solve(bool b) {
  if (s.size() == S[0].size()) {
    if (s == S[0]) {
      puts("Yes");
      exit(0);
    }
    return;
  }
  for (int i = p[b]; i < S[b].size(); i++) {
    s += S[b][i];
    int d = p[b];
    p[b] = i + 1;
    solve(!b);
    s.pop_back();
    p[b] = d;
  }
}
int main() {
  cin >> S[0] >> S[1];
  p[0] = p[1] = 0;
  solve(0);
  p[0] = p[1] = 0;
  solve(1);
  puts("No");
}
