Bash + GNU utilities, 17 bytes
tr '(|)D:-' 0-3\
Note: There's a space character after the backslash.
Input on stdin, output on stdout.
The challenge doesn't specify the format of the output. Depending on the input, this program may print the output in either %2d or %3d format (that is, with one or two spaces before the 0, 1, 2, or 3).
If that's not acceptable, then
tr -s '(|)D:-' 0-3\
(20 bytes) always prints the digit in %2d format. (There's a space after the backslash here too.)
Or
tr '(|)D:-' 0-4|tr -d 4
(23 bytes) prints just the digit (with no spaces).
- 8k
- 1
- 18
- 36