#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string a;
  cin >> a;
  auto n = (int)a.size();
  map<char, int> map1;
  char cur = 'a';
  bool flag = true;
  map1['a'] = 0, map1['b'] = 0, map1['c'] = 0;
  for (int i = 0; i < n; i++) {
    if (map1.count(a[i]))
      map1[a[i]]++;
    else
      map1[a[i]] = 1;
    if (a[i] == cur) continue;
    if (a[i] == 'b' && cur == 'a')
      cur = 'b';
    else if (a[i] == 'c' && cur == 'b')
      cur = 'c';
    else
      flag = false;
  }
  if (!flag) {
    cout << "NO\n";
    return 0;
  }
  if (map1['a'] > 0 && map1['b'] > 0 && map1['c'] > 0) {
    if (map1['a'] == map1['c'] || map1['b'] == map1['c']) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
