-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheck the string.cpp
More file actions
32 lines (31 loc) · 945 Bytes
/
Copy pathCheck the string.cpp
File metadata and controls
32 lines (31 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define sf(a) scanf("%d",&a)
#define pf(a) printf("%d\n",a)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define F first
#define S second
#define Check cout<< "Done in " << clock() / CLOCKS_PER_SEC <<" sec"<< endl;
#define FastRead ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main()
{
string s;
cin >> s;
int aa=0,bb=0,cc=0;
int i = 0;
while(s[i] == 'a' && i<s.size())
aa++ , i++;
while(s[i] == 'b' && i<s.size())
bb++ , i++;
while(s[i] == 'c' && i<s.size())
cc++ , i++;
if(i == s.size() && aa && bb && cc && (aa == cc || bb == cc))
cout << "YES\n";
else
cout << "NO\n";
}