Submission #1992543


Source Code Expand

Copy
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string s;
  cin>>s;
  vi v(3,0);
  rep(i,s.size()){
    if(s[i]=='a')v[0]++;
    if(s[i]=='b')v[1]++;
    if(s[i]=='c')v[2]++;
  }
  sort(all(v));
  if(v[2]-v[0]<=1)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Submission Info

Submission Time
Task B - Palindrome-phobia
User rika0384
Language C++14 (GCC 5.4.1)
Score 400
Code Size 878 Byte
Status
Exec Time 5 ms
Memory 512 KB

Test Cases

Set Name Score / Max Score Test Cases
sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
All 400 / 400 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt 1 ms 256 KB
01-02.txt 1 ms 256 KB
01-03.txt 1 ms 256 KB
01-04.txt 1 ms 256 KB
01-05.txt 1 ms 256 KB
01-06.txt 1 ms 256 KB
01-07.txt 1 ms 256 KB
01-08.txt 1 ms 256 KB
01-09.txt 1 ms 256 KB
01-10.txt 2 ms 256 KB
01-11.txt 2 ms 256 KB
01-12.txt 2 ms 256 KB
01-13.txt 5 ms 512 KB
01-14.txt 5 ms 512 KB
01-15.txt 5 ms 512 KB
01-16.txt 1 ms 256 KB
01-17.txt 1 ms 256 KB
01-18.txt 1 ms 256 KB
01-19.txt 1 ms 256 KB
01-20.txt 1 ms 256 KB
01-21.txt 1 ms 256 KB
01-22.txt 1 ms 256 KB
01-23.txt 1 ms 256 KB
01-24.txt 1 ms 256 KB
01-25.txt 1 ms 256 KB
01-26.txt 2 ms 256 KB
01-27.txt 5 ms 512 KB
01-28.txt 5 ms 512 KB
01-29.txt 5 ms 512 KB
01-30.txt 5 ms 512 KB
01-31.txt 5 ms 512 KB
sample-01.txt 1 ms 256 KB
sample-02.txt 1 ms 256 KB
sample-03.txt 1 ms 256 KB