Skip to content

Commit f381f06

Browse files
committed
Added 1146A - Love "A".cpp
1 parent 248b973 commit f381f06

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

1146A - Love A.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
7+
8+
int main()
9+
{
10+
string s;
11+
cin>>s;
12+
int A=0,O=0;
13+
for(auto i : s)
14+
{
15+
if(i=='a')
16+
A++;
17+
else
18+
O++;
19+
}
20+
if(A>O)
21+
cout<<s.size()<<endl;
22+
else if(A==O)
23+
{
24+
cout<<s.size()-1<<endl;
25+
}
26+
else
27+
{
28+
cout<<s.size()-(O-A+1)<<endl;
29+
}
30+
}

0 commit comments

Comments
 (0)