In typography, a counter is the area of a letter that is entirely or partially enclosed by a letter form or a symbol. A closed counter is a counter that is entirely enclosed by a letter form or symbol. You must write a program takes a string as input and prints the total number of closed counters in the text.
May be a command line input, or from STDIN, but you must specify which.
Will consist entirely of the printable ASCII characters, meaning all ASCII values between 32 and 126 inclusive. This does include spaces. More information.
Now, this does vary slightly between fonts. For example, the font you're reading this in considers 'g' to have one closed counter, whereas the google font has 'g' with two closed counters. So that this is not an issue, here are the official number of closed counters per character.
All the symbols with no closed counters:
Note that this includes space.
Here are all the symbols with one closed counter:
And here are all the symbols with 2 closed counters:
And last but not least, here are some sample inputs and outputs.
Programming Puzzles and Code-Golf should print
4 8 15 16 23 42 should print
All your base are belong to us should print
Standard loopholes apply should print
Shortest answer in bytes is the winner! should print