#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int maxn = 1e5 + 5;
string s;
map<char, int> c;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  for (int i = 0; i < s.length(); ++i) {
    c[s[i]]++;
  }
  bool check = true;
  int t = 0;
  for (int i = 1; i < s.length(); ++i) {
    if (s[i] != s[i - 1]) {
      if (s[i] == 'a' || (s[i] == 'b' && s[i - 1] == 'c') ||
          (s[i] == 'c' && s[i - 1] == 'a')) {
        check = false;
        break;
      }
    }
  }
  if (check && c['a'] && c['b'] && (c['c'] == c['a'] || c['c'] == c['b'])) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}
