func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize(2)   #pragma GCC optimize(3,  Ofast ,  inline )   using namespace std;   const long long mod = 1e9 + 7;   const long long M = 1e8 + 5;   const long long N = 6e5 + 5;   char s[N];   bool check() {     map<char, long long> mp;     long long len = strlen(s + 1);     long long l = 1;     while (s[l] ==  a ) l++;     if (l == 1) return 0;     long long pos = l;     while (s[l] ==  b ) l++;     if (l == pos) return 0;     while (s[l] ==  c ) l++;     if (l != len + 1) return 0;     for (register long long i = 1; i <= len; i++) mp[s[i]]++;     if (mp[ c ] == mp[ a ] || mp[ c ] == mp[ b ]) return 1;     return 0;   }   inline void solve() {     scanf( %s , s + 1);     puts(check() ?  YES  :  NO );   }   signed main() {     long long T = 1;     for (long long index = 1; index <= T; index++) {       solve();     }     return 0;   }   