Counter counter
Python 3, 63
print(sum(map(input().count,"#0469@ADOPQRabdegopq$%&8B$%&8B")))
A straightforward approach. Iterates over each character with a closed counter, summing the number of occurrences, doing so twice for characters with two closed counters. It would be the same length to instead write
"#0469@ADOPQRabdegopq"+"$%&8B"*2
Python 3 is needed to avoid raw_input
.
CJam, 41 39 37 34 bytes
"$%&8Badopq#0469@Rbeg"_A<eu+qfe=1b
Thanks to @jimmy23013 for golfing off 3 bytes!
Try it online.
How it works
"$%&8Badopq#0469@Rbeg" e# Push that string.
_A< e# Retrieve the first 10 characters.
eu+ e# Convert to uppercase and append.
e# This pushes "$%&8Badopq#0469@Rbeg$%&8BADOPQ".
q e# Read from STDIN.
fe= e# Count the occurrences of each character.
1b e# Base 1 conversion (sum).
Pyth, 31 bytes
sm@tjC"cúÁ-ÈN%³rØ|"3Cdz
Demonstration.
Note that the code may not be displayed properly due to the use of non-ASCII characters. The correct code is at the link.
I made a lookup table of the output desired for each input character, rotated it by 32 to make use of Pyth's modular indexing, stuck a 1 at the beginning, and interpreted it as a base 3 number, giving the number 2229617581140564569750295263480330834137283757
. I then converted this number to base 256 and converted it to a string, which is the string used in the answer.