Display number of occurrences for every character in an input string The code should take a string as input from keyboard:

The definition of insanity is quoting the same phrase again and again and not expect despair.


The output should be like this(not sorted in any particular order): 

  :  15
. :  1
T :  1
a :  10
c :  1
e :  8
d :  4
g :  3
f :  2
i :  10
h :  3
m :  1
o :  4
n :  10
q :  1
p :  3
s :  5
r :  2
u :  1
t :  6
y :  1
x :  1


All ASCII characters count unicode is not a requirement, spaces, quotes,etc and input should come from keyboard / not constants, attributes, output should be printed with new line after each character like in the above example, it should not be returned as string or dumped as hashmap/dictionary etc, so x :  1 and x: 1 are ok, but  {'x':1,... and x:1 are not. 

Q: Function or complete program taking stdin and writing stdout?
A: Code needs to be a program taking input using standard in and display the result via standard out.

Scoreboard:

Shortest overall: 5 bytes

Shortest overall: 7 bytes
PHP - 68 (or 39) bytes

&lt;?foreach(count_chars(fgets(STDIN),1)as$k=&gt;$v)echo chr($k)." : $v
";


Output for the example text:

  : 15
. : 1
T : 1
a : 10
c : 1
d : 4
e : 8
f : 2
g : 3
h : 3
i : 10
m : 1
n : 10
o : 4
p : 3
q : 1
r : 2
s : 5
t : 6
u : 1
x : 1
y : 1


If the exact output is not required, this would work for 39 bytes:

&lt;?print_r(count_chars(fgets(STDIN),1));


Sample output:

Array
(
    [32] =&gt; 15
    [46] =&gt; 1
    [84] =&gt; 1
    [97] =&gt; 10
    [99] =&gt; 1
    [100] =&gt; 4
    [101] =&gt; 8
    [102] =&gt; 2
    [103] =&gt; 3
    [104] =&gt; 3
    [105] =&gt; 10
    [109] =&gt; 1
    [110] =&gt; 10
    [111] =&gt; 4
    [112] =&gt; 3
    [113] =&gt; 1
    [114] =&gt; 2
    [115] =&gt; 5
    [116] =&gt; 6
    [117] =&gt; 1
    [120] =&gt; 1
    [121] =&gt; 1
)


where each numerical index refers the ordinal value of the character it represents.

I suspect very strongly that using an in-built function that does exactly what the problem states will soon be disallowed.