def b_count(pattern):
    """
    Count the number of B's that occur in a site pattern
    Input:
    pattern --- a site pattern
    Output:
    num_b --- the number of B's in the site pattern 
    """

    num_b = 0

    for char in pattern:
        if char == "B":
            num_b += 1

    return num_b