Given a string of printable ASCII, output the frequency of each character in that string.
The Challenge
- Input is given as a string of printable ASCII characters (decimal
[32-126]
inclusive). - Output the frequency of each character, in ASCII order.
- The output must have a format similar to
[character][separator][count]
. Provided that there is a single, non-newline separating string between the character and its frequency, it is a valid output. - Output can be a single string, multiple strings, list of 2-tuples, array of tuples, etc.
- Input and output can be given using any convenient method.
- Standard loopholes are forbidden.
- This is code-golf, so shortest in bytes wins.
Sample I/O
abcd
//outputs
a: 1
b: 1
c: 1
d: 1
Over 9001!
//outputs
[ 1
! [ 1
0 [ 2
1 [ 1
9 [ 1
O [ 1
e [ 1
r [ 1
v [ 1
--<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+.
//outputs (as 2-tuples)
(+,14),(-,13),(.,13),(<,21),(>,13),([,2),(],2)
Su3OH39IguWH
//outputs (as 2d array)
[[3,2],[9,1],[H,2],[I,1],[O,1],[S,1],[W,1],[g,1],[u,2]]
e
afterv
‽ \$\endgroup\$a,1b,2c,3
? \$\endgroup\$PETSCII
instead? -> c64-wiki.com/wiki/PETSCII Also, do you mean trueASCII
(7-bit), or simplyASCII
-compatible, like extendedASCII
orUTF-8
? \$\endgroup\$