#include <stdio.h>
int main()
{
int c = 0;
char* s;
char temp[200] = {};
scanf("%s", temp);
s = temp;
while (*s){
if (*s == '#') break;
if (*s == 'A' || *s == 'a')
++c;
++s;
}
printf("%d\n", c);
return 0;
}