void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  auto s=readln.chomp.to!(char[]);

  auto cnt=new int[](3);
  foreach(c; s) cnt[c-'a']++;

  auto mn=reduce!(min)(cnt);
  auto cnt1=map!(e=>e-mn)(cnt);
  writeln(cnt1);
  auto a=new int[](0);
  foreach(e; cnt1)if(e>0) a~=e;

  if(a.length==0){writeln("YES"); return;}
  if(a.length==1){
    if(a[0]<2){writeln("YES"); return;}
    else{writeln("NO"); return;}
  }
  if(a[0]<2 && a[1]<2){writeln("YES"); return;}
  else{writeln("NO"); return;}
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}