### Pure bash, <s>120</s> 107 bytes d=$*;d=${d//[ -z]/#};for a;do((b[${#a}]++));done;e=${!b[*]};for((i=0;i++<${e##* };)){ echo $i ${d:0:b[i]};} or d=$* d=${d//[ -z]/#} for a;do((b[${#a}]++));done e=${!b[*]} for((i=0;i++<${e##* };)){ echo $i ${d:0:b[i]} } or d=$*;d=${d//[ -z]/#};for a;do((b[${#a}]++));done;e=${!b[*]} for((i=0;i++<${e##* };)){ echo $i ${d:0:b[i]};} Sample: ./histogram.sh Very long strings of words should be just as easy to generate a histogram just as short strings of words are easy to generate a histogram for. 1 ## 2 ####### 3 # 4 ####### 5 ### 6 # 7 ## 8 ## 9 ##