#include <cctype>
#include <iostream>
#include <unordered_set>
#include <string>
using namespace std;

int countC(string s, char c){
    int res = 0;
    unordered_multiset<char> set;

    for(char i : s){
        set.insert(tolower(i));
    }
    res =  set.count(tolower(c));

    return res;
}

int main() {
     string s;
     char c;
     getline(cin, s);
     cin >> c;

     cout << countC(s, c) << endl;

     return 0;
}
// 64 位输出请用 printf("%lld")

unordered_multiset<char> 无序多元(值可重复),非键值对

set.insert();

set.count();