s = input().rstrip()
x = s.rfind('a')
if x == -1:
    print(-1)
else:
    print(x + 1)

71194c0a3679963feb25019d77ba13d8f6538155
<mask token>

<mask token>
if x == -1:
    print(-1)
else:
    print(x + 1)

s = input().rstrip()
x = s.rfind('a')
if x == -1:
    print(-1)
else:
    print(x + 1)
