- 8k
- 1
- 18
- 36
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
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).
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 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).
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).
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 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'D:-' 0-3|tr4|tr -cdd 0-34
(2423 bytes) prints just the digit (with no whitespacespaces).
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 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-3|tr -cd 0-3
(24 bytes) prints just the digit (with no whitespace).
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 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).
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 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:-' 0123\0-3\
(2120 bytes) always prints the digit in %2d format. (There's a space after the backslash here too.)
Or
tr '(|)D' 0123|tr0-3|tr -cd 0-3
(2524 bytes) prints just the digit (with no whitespace).
Bash + GNU utilities, 17 bytes
tr '(|)D:-' 0-3\
Note: There's a space character after the backslash.
The challenge doesn't specify the format of the output. Depending on the input, this 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:-' 0123\
(21 bytes) always prints the digit in %2d format.
Or
tr '(|)D' 0123|tr -cd 0-3
(25 bytes) prints just the digit (with no whitespace).
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 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-3|tr -cd 0-3
(24 bytes) prints just the digit (with no whitespace).