#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l = s.size();
  int a[26] = {0};
  for (int i = 0; i < l; i++) {
    a[s[i] - 'a']++;
  }
  int k = 0, g = 0;
  for (int i = 0; i < 26; i++) {
    if (a[i] > 0) k++;
    if (a[i] > g) g = a[i];
  }
  if (k == 2 || k == 3) {
    if (l - g > 1 && l > 3)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  } else if (k == 4) {
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
