#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ofstream g("bilet21.txt");
int main(){
char txt[200],*p;
cin.get(txt, 200);
int cuv=0, a=0;
p = strtok(txt, " ");
while(p){
cuv++;
for(int i=0;i<strlen(p);i++)
if(p[i]=='A')a++;
p = strtok(NULL, " ");
}
g << cuv << " " << a;
}