#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
string S;
map<char, int> cnt;
int N;
bool check(map<char, int> &tmp) {
  for (char i = 'a'; i <= 'c'; i++) {
    if (tmp[i] < 0) {
      return false;
    }
  }
  return true;
}
int main() {
  cin >> S;
  N = S.size();
  for (auto &val : S) {
    cnt[val]++;
  }
  if (N == 1) {
    cout << "YES" << endl;
    return 0;
  }
  if (N == 2) {
    if (cnt[0] != cnt[1]) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    return 0;
  }
  for (char i = 'a'; i <= 'c'; i++) {
    for (char j = 'a'; j <= 'c'; j++) {
      for (char k = 'a'; k <= 'c'; k++) {
        if (i == j or j == k or i == k) {
          continue;
        }
        map<char, int> tmp = cnt;
        int head = 0;
        bool ok = true;
        while (head < N) {
          if (not check(tmp)) {
            ok = false;
            break;
          }
          if (head % 3 == 0) {
            tmp[i]--;
          } else if (head % 3 == 1) {
            tmp[j]--;
          } else {
            tmp[k]--;
          }
          head++;
        }
        if (ok and check(tmp)) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
