#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vii = vector<int>;
using vll = vector<ll>;
template <class T>
using vv = vector<T>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
void show(const vector<T> &a) {
  for (int i = 0; i < (int)a.size(); ++i)
    cout << a[i] << (i != (int)a.size() - 1 ? " " : "\n");
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int dy[] = {0, 1, -1, 0};
int dx[] = {1, 0, 0, -1};
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  map<char, int> cnt;
  for (int i = 0; i < (s.size()); ++i) {
    cnt[s[i]]++;
  }
  int ma = 0, mi = 2001001001, p = 0;
  for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
    ma = max(ma, itr->second);
    mi = min(mi, itr->second);
    p++;
  }
  bool flag = true;
  if (p == 3) {
    if (ma - mi >= 2) flag = false;
  } else
    flag = false;
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
