#include <bits/stdc++.h>
using namespace std;
void solve() {
  string a;
  cin >> a;
  map<char, int> mp;
  for (int i = 0; i < a.length(); i++) mp[a[i]]++;
  if (mp.size() > 4 || mp.size() < 2) {
    cout << "No";
    return;
  }
  if (mp.size() == 4) {
    cout << "Yes";
    return;
  }
  if (mp.size() == 3) {
    bool ok = 0;
    for (auto it : mp) {
      if (it.second >= 2) {
        ok = 1;
      }
    }
    if (ok) {
      cout << "Yes";
    } else {
      cout << "No";
    }
    return;
  }
  bool ok = 0;
  for (auto it : mp) {
    if (it.second < 2) ok = 1;
  }
  if (ok) {
    cout << "No";
  } else {
    cout << "Yes";
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
loop:
  while (t--) {
    solve();
  }
}
