We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d62994 commit f046236Copy full SHA for f046236
1579A.cpp
@@ -0,0 +1,31 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+int main(){
5
+ int t;
6
+ cin>>t;
7
+ string s;
8
+ while(t--){
9
+ cin>>s;
10
+ int a = 0, b = 0, c = 0;
11
+ for(int i = 0; i < s.size(); i++){
12
+ if(s[i] == 'A'){
13
+ a++;
14
+ continue;
15
+ }
16
+ if(s[i] == 'B'){
17
+ b++;
18
19
20
+ if(s[i] == 'C'){
21
+ c++;
22
23
24
25
+ if(a + c == b){
26
+ cout<<"YES"<<endl;
27
28
29
+ cout<<"NO"<<endl;
30
31
+}
0 commit comments