#include <bits/stdc++.h>
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const long long LINF = 1e18;
using namespace std;
long long n, cnt, ans, a, b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
long double doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge {
  int to, cost;
};
map<char, long long> mp;
string mae, usiro;
pair<long long, int> p[ohara];
map<char, int> che;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
    mp[s[i]]++;
  }
  if (mp['a'] == 0 && mp['b'] == 0)
    cout << ("NO") << endl;
  else if (mp['a'] == 0 && mp['c'] == 0)
    cout << ("NO") << endl;
  else if (mp['b'] == 0 && mp['c'] == 0)
    cout << ("NO") << endl;
  else if (mp['a'] == 0) {
    if (mp['b'] == 1 && mp['c'] == 1)
      cout << ("YES") << endl;
    else
      cout << ("NO") << endl;
  } else if (mp['b'] == 0) {
    if (mp['a'] == 1 && mp['c'] == 1)
      cout << ("YES") << endl;
    else
      cout << ("NO") << endl;
  } else if (mp['c'] == 0) {
    if (mp['a'] == 1 && mp['b'] == 1)
      cout << ("YES") << endl;
    else
      cout << ("NO") << endl;
  } else {
    ans = 0;
    int ok = 0;
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      if (i % 3 == 0) {
        if (mp['a'] == 0) ok = 1;
        mp['a']--;
      } else if (i % 3 == 1) {
        if (mp['b'] == 0) ok = 1;
        mp['b']--;
      } else {
        if (mp['c'] == 0) ok = 1;
        mp['c']--;
      }
    }
    if (!ok) ans = 1;
    ok = 0;
    mp['a'] = 0;
    mp['b'] = 0;
    mp['c'] = 0;
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      mp[s[i]]++;
    }
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      if (i % 3 == 0) {
        if (mp['a'] == 0) ok = 1;
        mp['a']--;
      } else if (i % 3 == 1) {
        if (mp['c'] == 0) ok = 1;
        mp['c']--;
      } else {
        if (mp['b'] == 0) ok = 1;
        mp['b']--;
      }
    }
    if (!ok) ans = 1;
    ok = 0;
    mp['a'] = 0;
    mp['b'] = 0;
    mp['c'] = 0;
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      mp[s[i]]++;
    }
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      if (i % 3 == 0) {
        if (mp['b'] == 0) ok = 1;
        mp['b']--;
      } else if (i % 3 == 1) {
        if (mp['a'] == 0) ok = 1;
        mp['a']--;
      } else {
        if (mp['c'] == 0) ok = 1;
        mp['c']--;
      }
    }
    if (!ok) ans = 1;
    ok = 0;
    mp['a'] = 0;
    mp['b'] = 0;
    mp['c'] = 0;
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      mp[s[i]]++;
    }
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      if (i % 3 == 0) {
        if (mp['b'] == 0) ok = 1;
        mp['b']--;
      } else if (i % 3 == 1) {
        if (mp['c'] == 0) ok = 1;
        mp['c']--;
      } else {
        if (mp['a'] == 0) ok = 1;
        mp['a']--;
      }
    }
    if (!ok) ans = 1;
    ok = 0;
    mp['a'] = 0;
    mp['b'] = 0;
    mp['c'] = 0;
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      mp[s[i]]++;
    }
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      if (i % 3 == 0) {
        if (mp['c'] == 0) ok = 1;
        mp['c']--;
      } else if (i % 3 == 1) {
        if (mp['a'] == 0) ok = 1;
        mp['a']--;
      } else {
        if (mp['b'] == 0) ok = 1;
        mp['b']--;
      }
    }
    if (!ok) ans = 1;
    ok = 0;
    mp['a'] = 0;
    mp['b'] = 0;
    mp['c'] = 0;
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      mp[s[i]]++;
    }
    for (int(i) = 0; (i) < (int)((s).size()); (i)++) {
      if (i % 3 == 0) {
        if (mp['c'] == 0) ok = 1;
        mp['c']--;
      } else if (i % 3 == 1) {
        if (mp['b'] == 0) ok = 1;
        mp['b']--;
      } else {
        if (mp['a'] == 0) ok = 1;
        mp['a']--;
      }
    }
    if (!ok) ans = 1;
    if (ans)
      cout << ("YES") << endl;
    else
      cout << ("NO") << endl;
  }
  return 0;
}
