def read_input(filename):
    """
    >>> template, ins_rules = read_input('example')
    >>> template
    'NNCB'
    >>> len(ins_rules)
    16
    >>> ins_rules['NH']
    'C'
    >>> ins_rules['BH']
    'H'
    """
    template = ""
    ins_rules = {}
    with open(filename) as fd:
        for line in fd:
            line = line.strip()
            if " -> " in line:
                a, b = line.split(" -> ")
                ins_rules[a] = b
            elif len(line):
                template = line
    return template, ins_rules