def _get_alignments_skipped_bad_char_rule(
    mismatched_char: str, pattern_prefix: str
) -> int:
    """Get the number of alignments that can be skipped according to bad
    character rule in Boyer Moore's exact matching algorithm
    >>> _get_alignments_skipped_bad_char_rule("C", "ATCTTTATCATA")
    3
    >>> _get_alignments_skipped_bad_char_rule("G", "ATCTTTATCATA")
    12
    >>> _get_alignments_skipped_bad_char_rule("T", "GTAGCGGC")
    6
    >>> _get_alignments_skipped_bad_char_rule("C", "GTAGC")
    0
    >>> _get_alignments_skipped_bad_char_rule("C", "GT")
    2
    """
    reverse_pattern_prefix = pattern_prefix[::-1]  # checking from right to left
    len_pattern_prefix = len(pattern_prefix)
    for index in range(len_pattern_prefix):
        if reverse_pattern_prefix[index] == mismatched_char:
            return index
    return len(pattern_prefix)