The floor plan of a house is given on a grid. The character I is a wall and the character . is room floor space; each character occupies $1$ square metre. Doorways are not shown.
A room is a maximal group of . cells connected horizontally or vertically. No room is larger than $64$ square metres.
You are given a supply of hardwood flooring measured in square metres. You install the flooring starting with the largest room, then the next largest, and so on. Flooring a room consumes an amount of wood equal to its area, you may not skip any room, and you must stop as soon as you do not have enough wood for the next room.
Output how many rooms receive flooring and how many square metres of flooring are left over.
I or .).Print exactly one line in the format
K rooms, M square metre(s) left over
where $K$ is the number of rooms that received flooring and $M$ is the number of square metres left over.