#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  set<char> c;
  int f[26];
  memset(f, 0, sizeof(f));
  for (int i = 0; i < s.length(); i++) {
    c.insert(s[i]);
    f[s[i] - 'a']++;
  }
  if (s.length() < 4 || c.size() == 1 || c.size() > 4) {
    cout << "No";
    return 0;
  }
  if (c.size() == 2) {
    set<char>::iterator it = c.begin();
    if (f[*it - 'a'] < 2) {
      cout << "No";
      return 0;
    }
    it++;
    if (f[*it - 'a'] < 2) {
      cout << "No";
      return 0;
    }
    cout << "Yes";
  } else {
    cout << "Yes";
  }
}
