def part_2(passwords):
    """
    Ensure the target character appears in exactly one position using XOR.
    """
    valid = 0
    for (pos_a, pos_b, key_letter, password) in passwords:
        if (password[pos_a - 1] == key_letter) ^ (password[pos_b - 1] == key_letter):
            valid += 1
    return valid