#include #define rep(i,a,n) for (int i = a;i < n;i++) using namespace std; int main() { int ans=0,c=0; string s; cin >> s; rep(i,0,s.size()){ if(s[i] == 'A'){ ans = i-c; c++; } } cout << ans << endl; }