#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  map<char, long long> m;
  std::vector<char> z;
  long long letters = 0;
  for (long long i = 0; i <= s.length() - 1; i++) {
    if (!m[s[i]]) {
      ++letters;
      z.push_back(s[i]);
    }
    m[s[i]]++;
  }
  if (letters > 4 || letters < 2) {
    cout << "No" << endl;
    return 0;
  }
  if (letters == 2) {
    if (m[z[0]] == 1 || m[z[1]] == 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (letters == 3) {
    if (s.length() == 3) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
