A 3 by 3 grid can contain up to 24 matchsticks as shown below. Two consecutive - characters represent one horizontal matchstick, and two consecutive | characters represent one vertical matchstick.
Each + marks a vertex where two or more matchsticks may meet; there are 16 such vertices. Every other background cell is written as ..
When all 24 matchsticks are present, the drawing contains 14 complete squares: nine 1 by 1 squares, four 2 by 2 squares, and one 3 by 3 square. Removing some matchsticks can reduce that number. In the arrangement below, 5 matchsticks have been removed and only 4 complete squares remain.
Given a matchstick arrangement, let A be the number of removed matchsticks and B be the number of complete squares that remain. Write a program that computes A and B.