시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB113604451.163%

문제

Yesterday, for the first time, Tosha took part in a programming contest. But the problems were so difficult that sometimes he wanted to scream. Tosha knew that noise during the contest is prohibited, so he had to scream on paper: he sometimes wrote a few letters "A" on a piece of paper, when he felt that the task was too difficult. The more difficult the problem was, the more letters "A" Tosha wrote down in the process of solving it.

The next day Tosha wanted to boast to his classmates that he had participated in the contest and solved a lot of problems. But he forgot the number of problems and even didn't have the statements to check. Fortunately, Tosha saved his notes, so now he can roughly estimate the number of problems. 

He remembers that all the problems had different non-zero difficulty, which means that solving each task he wrote a distinct positive number of letters "A". And these screaming letters conveniently stands out, because there are no other uppercase letters, all other notes he made in lowercase. Note that he could write down some lowercase notes between "A"-s he wrote for the same problem.

Help Tosha to find out what is the the maximum number of problems that could have been there in the contest.

입력

Input contains a nonempty string $s$ consisting of lowercase English letters and characters "A". The length of $s$ does not exceed $10^6$, it contains at least one "A".

출력

Print one integer --- the maximum number of problems in the contest.

예제 입력 1

dfsAAfftaAbcdAAtoshaAtoAApA

예제 출력 1

3