Mike wrote some text on a piece of paper using only upper case letters and spaces, and now he wants to know how many holes the text has.
What counts as a hole here? Think of the paper as a plane and of each letter as a curve drawn on that plane. Every letter splits the plane into regions. The letters A and O split the plane into two regions, so each of them has one hole. B has two holes, and C, E, F and K have none. A space has no holes.
This problem fixes one hole count per letter. B is the only letter with two holes. The letters A, D, O, P, Q and R have one hole each. Every other upper case letter, and the space, has none.
The number of holes in a line is the sum of the holes of the letters on that line. Report that number for each line.