#include <bits/stdc++.h>
using namespace std;
char s1[100005];
int main() {
  while (scanf("%s", s1 + 1) != EOF) {
    int len = strlen(s1 + 1);
    if (len < 4)
      printf("No\n");
    else {
      sort(s1 + 1, s1 + 1 + len);
      int sum = 0;
      for (int a = 2; a <= len; a++)
        if (s1[a] != s1[a - 1]) sum++;
      sum++;
      if (sum > 4)
        printf("No\n");
      else if (sum == 4)
        printf("Yes\n");
      else if (sum == 3)
        printf("Yes\n");
      else if (sum == 2) {
        int temp = 1;
        for (int a = 2; a <= len; a++) {
          if (s1[a] == s1[a - 1])
            temp++;
          else
            break;
        }
        if (temp == 1 || temp == len - 1)
          printf("No\n");
        else
          printf("Yes\n");
      } else if (sum == 1)
        printf("No\n");
    }
  }
  return 0;
}
