#include<bits/stdc++.h>
using namespace std;
int countAC(string s) {
int count = 0;
int n = s.length();
for (int i = 0; i < n; ++i) {
if (s[i] == 'A') {
string modified = s;
modified[i] = 'C';
int currCount = 0;
for (int j = 0; j < n - 1; j) {
if (modified[j] == 'A' && modified[j + 1] == 'C') {
currCount;
}
}count = max(count, currCount);
}else if (s[i] == 'C') {
string modified = s;
modified[i] = 'A';
int currCount = 0;
for (int j = 0; j < n - 1; j) {
if (modified[j] == 'A' && modified[j + 1] == 'C') {
currCount;
}
}count = max(count, currCount);
}
}ret urn count;
}int main() {
string s;
cin >> s;
int ans = countAC(s);
cout << ans << endl;
}