#include <bits/stdc++.h>
using namespace std;
char s[100011];
int f[1111], id[1111];
bool dp[100011][3][3][5][5];
bool chk() {
  int cnt = 0, len = strlen(s);
  memset(f, 0, sizeof f);
  for (int i = 0; i < len; i++) {
    s[i] -= 'a';
    if (!f[s[i]]) cnt++;
    f[s[i]]++;
  }
  if (len < 4) return false;
  if (cnt < 2 || cnt > 4) return false;
  if (cnt == 3 || cnt == 4) return true;
  if (cnt == 2) {
    int x = -1;
    for (int i = 0; i < 26 && x < 0; i++)
      if (f[i] > 0) x = f[i];
    if (x == 1 || x == len - 1) return false;
    return true;
  }
  memset(id, 0, sizeof id);
  int idn = 0;
  for (int i = 0; i < 26; i++)
    if (f[s[i]] > 0 && !id[s[i]]) {
      id[s[i]] = ++idn;
    }
  for (int i = 0; i < len; i++) s[i] = id[s[i]];
  memset(dp, false, sizeof dp);
  dp[0][1][0][s[0]][0] = true;
  dp[0][0][1][0][s[0]] = true;
  for (int i = 1; i < len; i++)
    for (int j = 0; j <= 2; j++)
      for (int k = 0; k <= 2; k++)
        for (int x = 0; x <= idn; x++)
          for (int y = 0; y <= idn; y++) {
            if (!dp[i - 1][j][k][x][y]) continue;
            if (s[i] == x || s[i] == y) dp[i][j][k][x][y] = true;
            if (j < 2 && s[i] != x) dp[i][j + 1][k][s[i]][y] = true;
            if (k < 2 && s[i] != y) dp[i][j][k + 1][x][s[i]] = true;
          }
  for (int x = 1; x <= idn; x++)
    for (int y = 1; y <= idn; y++)
      if (dp[len - 1][2][2][x][y]) return true;
  return false;
}
int main() {
  scanf("%s", s);
  puts(chk() ? "Yes" : "No");
  return 0;
}
