7
GOAL : To Implement a character counting program
This is how this counting system works :
input of the program is a set of printable ASCII characters . the program counts each type of character , and outputs the number of each character , starting from first mentioned character to last mentioned character .
Example :
input : aaaabbbbbcccc 123445b
output : 4 6 4 4 1 1 1 2 1
Which 4
is number of a
s , 6
is number of b
s , 4
is number of c
s , 4
is number of spaces () and so on . Also you can split answers with space (like example) , EOL , or anything other than numerals .
Rules
Your program must log to STDOUT or an acceptable alternative, if STDOUT is not available.
Your program must be a full, runnable program, and not a function or snippet
It's optional to mention the ungolfed version of program and/or a short explanation .
Test input : ThIs Is ThE iNPUT , WITH 72/2 CHARS!
Test output : 4 2 3 2 7 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1
4What is the reason for disallowing functions? Does not make much sense for this challenge and gives a significant disadavante to languages like Java. – Denker – 2016-06-23T11:13:46.443
2
For reference, the default allows programs and functions but disallows snippets and also allows a few alternative output methods. This is a nice first challenge, but nevertheless I'd recommend posting future challenge ideas in the sandbox so you can get feedback before posting them. :)
– Martin Ender – 2016-06-23T12:15:02.9972Spaces, newlines, tabs, carriage returns, nonbreaking spaces and vertical tabs are *not printable ASCII*, yet your example contains and counts spaces. Do we count all the bytes of the input or not? – cat – 2016-06-23T13:43:11.187
Can there be a trailing space? – Daniel – 2016-06-23T13:51:54.333
2
@cat Spaces are printable ASCII.
– Martin Ender – 2016-06-23T15:33:25.130