#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << showpoint << setprecision(10);
  string s;
  cin >> s;
  map<char, int> mp;
  for (int i = 0; i < s.size(); i++) {
    mp[s[i]]++;
  }
  if (s.size() > 3) {
    if (mp.size() == 1 || mp.size() > 4) {
      cout << "NO";
    } else if (mp.size() > 2) {
      cout << "YES";
    } else {
      auto it = mp.begin();
      if (it->second == 1) {
        cout << "NO";
        return 0;
      }
      ++it;
      if (it->second == 1) {
        cout << "NO";
        return 0;
      }
      cout << "YES";
    }
  } else {
    cout << "NO";
  }
}
