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 248b973 commit f381f06Copy full SHA for f381f06
1146A - Love A.cpp
@@ -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
27
28
+ cout<<s.size()-(O-A+1)<<endl;
29
30
+}
0 commit comments