Alice has a string $s$. She really likes the letter "a". She calls a string good if strictly more than half of the characters in that string are "a"s. For example "aaabb", "axaa" are good strings, and "baca", "awwwa", "" (empty string) are not.

Alice can erase some characters from her string $s$. She would like to know what is the longest string remaining after erasing some characters (possibly zero) to get a good string. It is guaranteed that the string has at least one "a" in it, so the answer always exists.


-----Input-----

The first line contains a string $s$ ($1 \leq |s| \leq 50$) consisting of lowercase English letters. It is guaranteed that there is at least one "a" in $s$.


-----Output-----

Print a single integer, the length of the longest good string that Alice can get after erasing some characters from $s$.


-----Examples-----
Input
xaxxxxa

Output
3

Input
aaabaa

Output
6



-----Note-----

In the first example, it's enough to erase any four of the "x"s. The answer is $3$ since that is the maximum number of characters that can remain.

In the second example, we don't need to erase any characters.

Difficulty: interview

Starter code:

Solutions:
s = input()
c = s.count('a')
print(min(2*c-1,len(s)))

a = input()
c = a.count('a')
print(min(len(a), c * 2 - 1))


s = input()
z = s.count('a')
r = len(s) - z
print(z + min(z-1,r))


def main():
    s = input()
    n = len(s)
    a = s.count('a')
    print(min(a + a - 1, n))
    return 0

main()

s=input()
a=s.count("a")
b=len(s)
if a>b/2:
    print(b)
else:
    print(2*a-1)

s = input()
z = s.count('a')
print(min(z * 2 - 1, len(s)))

st = input()
x = st.count('a')
y = len(st) - x
while x <= y:
    y -= 1
print(x + y)


s = input()
a = 0
t = 0
for i in s:
    if i == 'a':
        a += 1
    else:
        t += 1

print(a + min(a - 1, t))

s = input()
wyn = 0
for i in s:
	if i == "a":
		wyn += 1
print(min(len(s),2*wyn-1))

from collections import Counter

s = input()
c = Counter(list(s))

print(min(len(s), 2*c['a']-1))

from collections import Counter

S=input()

C=Counter(S)

L=len(S)

A=C["a"]

print(min(A*2-1,L))


from collections import Counter
S = input()
SC = Counter(S)
a = SC['a']
print(min(len(S), 2*a-1))

s=input()

nba=len([k for k in s if k=="a"])

res = nba+min(nba-1,len(s)-nba)

print(res)

s = input()
x = s.count('a')
print(min(len(s), 2*x-1))


s = input()
ka = s.count('a')

print(min(ka*2-1, len(s)))

s = input()
a = s.count("a")
if a > len(s) // 2:
    print(len(s))
else:
    print(2 * a - 1)


s = input()
c = s.count('a')
if c > len(s)//2 :
    print(len(s))
else:
    print(2*c -1)

s=input()
k=s.count('a')
n=len(s)
while k<=n/2: 
    n-=1
print(n)

s = input()
c = s.count('a')
n = len(s)
print(min(n, 2 * c - 1))


def solve():
    s = input()
    
    print (min(len(s), 2 * s.count("a") - 1))
    
def __starting_point():  
    solve()
__starting_point()

s = input()

cnt = 0
for elem in s:
	if elem == 'a':
		cnt += 1
print(min(len(s), max(cnt * 2 - 1, 0)))

s = input()
print(min(s.count('a')*2-1, len(s)))

S = input()
A = 0
B = 0
for s in S:
    if s == "a":
        A += 1
    else:
        B += 1

print(min(A*2-1, A+B))


s = input()
print(max(0, min(s.count('a') * 2 - 1, len(s))))

s = input()
ct = 0
for i in s:
    if i == 'a':
        ct += 1
l = len(s)
ans = min(l,2*ct -1)
print(ans)