while True:
    try:
        input_str = input()
        want_char = input().lower()
        new_str = input_str.lower()
        count = new_str.count(want_char)
        print(count)
        
    except EOFError:
        break