#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, int> m;
  char ch;
  while ((ch = getchar()) != '\n') {
    m[ch]++;
  }
  int c = m.size(), count = 0;
  map<char, int>::iterator it = m.begin();
  while (it != m.end()) {
    if (it->second >= 2) {
      count++;
    }
    it++;
  }
  if (c == 4 || (c == 3 && count >= 1) || (c == 2 && count >= 2)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
