#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (n == 1) {
    cout << "YES" << endl;
    return 0;
  }
  int alp[26] = {};
  queue<char> q;
  for (int i = (0); i < (int)(n); i++) {
    alp[s[i] - 'a']++;
    q.push(s[i]);
  }
  for (int i = (0); i < (int)(26); i++) {
    if (alp[i] > n / 2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  string s2 = "";
  int cnt = 0;
  int lim = 0;
  while (!q.empty()) {
    char c = q.front();
    q.pop();
    if (cnt > lim) {
      cout << "NO" << endl;
      return 0;
    }
    if (s2.size() == 0)
      s2 += c;
    else if (s2.size() == 1) {
      if (s2[0] != c)
        s2 = c + s2;
      else {
        q.push(c);
        cnt++;
        lim = q.size();
      }
    } else {
      if (s2[0] != c && s2[1] != c) {
        s2 = c + s2;
        cnt = 0;
      } else if (s2[s2.size() - 1] != c && s2[s2.size() - 2] != c) {
        s2 += c;
        cnt = 0;
      } else {
        q.push(c);
        cnt++;
        lim = q.size();
      }
    }
  }
  if (s2.size() > 2) {
    for (int i = (2); i < (int)(s2.size()); i++) {
      if (s2[i - 1] == s2[i] || s2[i - 2] == s2[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
