Skip to content

Commit f046236

Browse files
committed
Casimir's String Solitaire
1 parent 7d62994 commit f046236

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

1579A.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
continue;
19+
}
20+
if(s[i] == 'C'){
21+
c++;
22+
continue;
23+
}
24+
}
25+
if(a + c == b){
26+
cout<<"YES"<<endl;
27+
continue;
28+
}
29+
cout<<"NO"<<endl;
30+
}
31+
}

0 commit comments

Comments
 (0)