def str_to_pairs(poly: str) -> dict:
    """For the parm string, return a dictionary of counts of adjacent paris of characters.
    For example 'AAAB, returns {'AA': 2, AB: 1}."""
    pairs = {}
    for i in range(len(poly) - 1):
        pair = poly[i:i+2]
        if pair in pairs:
            pairs[pair] += 1
        else:
            pairs[pair] = 1
    return pairs