#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, x;
  cin >> s;
  int p = 0, q = 0, r = 0, t = 0;
  for (int i = 0; i < s.length() - 1; i++)
    if (s[i] != s[i + 1]) x[t++] = s[i + 1];
  if (t != 2)
    cout << "NO";
  else {
    if (x[0] != 'b' || x[1] != 'c')
      cout << "NO";
    else {
      for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'a') p++;
        if (s[i] == 'b') q++;
        if (s[i] == 'c') r++;
      }
      if (q == 0)
        cout << "NO";
      else {
        if (p == r || r == q)
          cout << "YES";
        else
          cout << "NO";
      }
    }
  }
  return 0;
}
