#C9778. Maximum Length String Without Consecutive A's

    ID: 53908 Type: Default 1000ms 256MiB

Maximum Length String Without Consecutive A's

Maximum Length String Without Consecutive A's

Given a string S consisting of lowercase letters, remove the minimum number of characters such that the resulting string does not contain any two consecutive a's. The purpose is to maximize the length of the processed string.

For example, if S is "babaa", we can remove one of the consecutive a's so that the longest valid string has length 4.

Note: Only the minimal number of removals is allowed, and the final string must never have two a's in a row.

inputFormat

The input consists of a single line containing the string S.

outputFormat

Output a single integer denoting the maximum length of the string after the minimal number of removals so that no two consecutive a's remain.

## sample
babaa
4