fork(2) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. string s;
  6. cin >> s;
  7. if(s.length()%2 != 0) {cout << "NO\n"; return 0;}
  8. vector<int> P(26,0);
  9. for(int i =0; i < s.length(); i++) P[s[i]-'a']++;
  10. sort(P.begin(),P.end());
  11. cout << ((P[25]*2 <= s.length())?"YES\n":"NO\n");
  12. return 0;}
Success #stdin #stdout 0s 3480KB
stdin
abc
stdout
NO