#include <bits/stdc++.h>
using namespace std;
map<char, int> mp;
int main() {
  string s;
  cin >> s;
  int i, lg = 0;
  for (i = 0; i < s.size(); i++) {
    if (mp.count(s[i])) {
      mp[s[i]]++;
      if (mp[s[i]] == 2) lg++;
    } else
      mp[s[i]] = 1;
  }
  lg = mp.size() - lg;
  if (mp.size() > 4)
    printf("No\n");
  else if (mp.size() == 2 && lg)
    printf("No\n");
  else if (mp.size() == 1)
    printf("No\n");
  else if (mp.size() == 3 && lg == 3)
    printf("No\n");
  else
    printf("Yes\n");
  return 0;
}
