#include <bits/stdc++.h>
using namespace std;
const int MAXN = -1;
int n;
string s;
map<char, int> M;
int main() {
  while (cin >> s) {
    n = s.size();
    M.clear();
    for (int i = (0); i < (int)(n); i++) M[s[i]]++;
    bool anda = true;
    int m = M.size();
    switch (m) {
      case 2: {
        for (auto it = M.begin(); it != M.end(); ++it)
          if ((it->second) == 1) anda = false;
        break;
      }
      case 3: {
        anda = false;
        for (auto it = M.begin(); it != M.end(); ++it)
          if ((it->second) > 1) anda = true;
        break;
      }
      case 4: {
        break;
      }
      default: {
        anda = false;
        break;
      }
    }
    if (anda)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
