#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
int main() {
  string s;
  cin >> s;
  int x = 0;
  for (int i = 0; i < s.size(); i++) {
    if (m[s[i]] == 0) x++;
    m[s[i]]++;
  }
  if (x > 4 || x < 2)
    cout << "No" << endl;
  else if (x == 2) {
    for (int i = 0; i < s.size(); i++) {
      if (m[s[i]] < 2) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  } else if (x == 3) {
    if (s.size() >= 4)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  } else if (x == 4) {
    cout << "Yes" << endl;
  }
}
