#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238;
const double E = 2.718281828459045235;
const int MOD = 1000000007;
const long long INF = 1000000000;
string s;
int a[30], k = 0;
int main() {
  cin >> s;
  for (int i = 0; i < ((int)(s).size()); i++) {
    if (a[s[i] - 'a'] == 0) k++;
    a[s[i] - 'a']++;
  }
  if (k > 4 || k == 1) {
    cout << "NO";
    return 0;
  }
  if (k == 4) {
    cout << "YES";
    return 0;
  }
  if (k == 3) {
    for (int i = 0; i < 30; i++)
      if (a[i] >= 2) {
        cout << "YES";
        return 0;
      }
    cout << "NO";
    return 0;
  }
  if (k == 2) {
    int t = 0;
    for (int i = 0; i < 30; i++)
      if (a[i] >= 2) t++;
    if (t == 2) {
      cout << "YES";
      return 0;
    } else {
      cout << "NO";
      return 0;
    }
  }
  return 0;
}
