#include <iostream>
using namespace std;
signed main() {
string x;
cin >> x;
char dig = x[x.length()-1];
int ans = 0;
for(int i = 0; i < x.length()-1; i++)
if(x[i] == dig)
ans++;
cout << ans;
}
#include <iostream>
using namespace std;
signed main() {
string x;
cin >> x;
char dig = x[x.length()-1];
int ans = 0;
for(int i = 0; i < x.length()-1; i++)
if(x[i] == dig)
ans++;
cout << ans;
}