#include <bits/stdc++.h>
using namespace std;
string str[2];
int main() {
  while (cin >> str[0] >> str[1]) {
    if (str[0].size() != str[1].size()) {
      puts("NO");
      continue;
    }
    string num[2];
    int t = 0;
    for (int i = 0; i < str[0].size(); i++)
      if (str[0][i] != str[1][i]) {
        num[0] += str[0][i];
        num[1] += str[1][i];
      }
    reverse(num[0].begin(), num[0].end());
    if (num[0] == num[1] && num[0].size() <= 2)
      puts("YES");
    else
      puts("NO");
  }
}
