#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  while (cin >> s1 >> s2) {
    if (s1.size() != s2.size())
      cout << "NO" << endl;
    else {
      for (int i = 0; i < s1.size(); i++) {
        if (s1[i] != s2[i]) {
          for (int j = i + 1; j < s1.size(); j++) {
            if (s1[j] != s2[j]) {
              swap(s1[i], s1[j]);
              break;
            }
          }
          break;
        }
      }
      (s1 == s2) ? cout << "YES\n" : cout << "NO\n";
    }
  }
  return 0;
}
