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