#include <bits/stdc++.h>
using namespace std;
const long long int MAX = 2e5 + 5;
long long int f[MAX], in[MAX], ifac[MAX];
void fact() {
  f[0] = f[1] = 1;
  for (long long int i = 2; i < MAX; i++) f[i] = (f[i - 1] * i) % 1000000007;
  in[0] = 1, in[1] = 1;
  for (long long int i = 2; i < MAX; i++)
    in[i] = 1000000007 - (1000000007 / i) * in[1000000007 % i] % 1000000007;
  ifac[0] = 1;
  for (long long int i = 1; i < MAX; i++)
    ifac[i] = (in[i] * ifac[i - 1]) % 1000000007;
}
long long int ncr(long long int n, long long int r) {
  if (n < r) return 0;
  return (f[n] * (ifac[n - r] * ifac[r] % 1000000007)) % 1000000007;
}
bool pp(long long int n) {
  if (n < 2) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) return false;
  }
  return true;
}
long long int hightet_fac(long long int n) {
  for (long long int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      return n / i;
    }
  }
  return 1;
}
void solve() {
  string s;
  cin >> s;
  if (s.size() < 4) {
    cout << "NO"
         << "\n";
    return;
  }
  map<char, long long int> m;
  for (auto x : s) m[x]++;
  if (m.size() == 1 || (m.size() > 4)) {
    cout << "NO"
         << "\n";
    return;
  }
  if (m.size() == 2) {
    long long int mn = 10000000000000007;
    for (auto x : m) mn = min(mn, x.second);
    if (mn == 1) {
      cout << "NO"
           << "\n";
      return;
    }
    cout << "YES"
         << "\n";
    return;
  }
  cout << "YES"
       << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.exceptions(cin.failbit);
  long long int tc = 1;
  while (tc--) {
    solve();
  }
}
