#include <bits/stdc++.h>
using namespace std;
int c[500];
int main() {
  string s;
  cin >> s;
  set<char> second;
  for (int i = 0; i < (int)(s.length()); ++i) {
    second.insert(s[i]);
    c[s[i] - '0']++;
  }
  if (second.size() == 1 || second.size() > 4) return cout << "No\n", 0;
  if (second.size() == 2) {
    for (auto i : second)
      if (c[i - '0'] == 1) return cout << "No\n", 0;
    return cout << "Yes\n", 0;
  }
  if (second.size() == 3) {
    if (s.length() >= 4)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  if (second.size() == 4) {
    cout << "Yes\n";
  }
}
