Skip to main content
added 159 characters in body
Source Link
Danko Durbić
  • 10.8k
  • 5
  • 28
  • 32

Powershell, 97 93

$a=@{};$args-split ' '|%{$a[$_.length]++};1..($a.Keys|sort)[-1]|%{"{0,-2} |"-f $_+"#"*$a[$_]}

Example:

PS Z:\> .\hist.ps1 This is an example of this program running
1  |
2  |###
3  |
4  |##
5  |
6  |
7  |###

Powershell, 97 93

$a=@{};$args-split ' '|%{$a[$_.length]++};1..($a.Keys|sort)[-1]|%{"{0,-2} |"-f $_+"#"*$a[$_]}

Powershell, 97 93

$a=@{};$args-split ' '|%{$a[$_.length]++};1..($a.Keys|sort)[-1]|%{"{0,-2} |"-f $_+"#"*$a[$_]}

Example:

PS Z:\> .\hist.ps1 This is an example of this program running
1  |
2  |###
3  |
4  |##
5  |
6  |
7  |###
added 6 characters in body
Source Link
Danko Durbić
  • 10.8k
  • 5
  • 28
  • 32

Powershell, 9797 93

$a=@{};$args-split ' '|%{$a[$_.length]++};1..($a.Keys|sort -des)[0]|%[-1]|%{"{0,-2} |"-f $_+"#"*$a[$_]}

Powershell, 97

$a=@{};$args-split ' '|%{$a[$_.length]++};1..($a.Keys|sort -des)[0]|%{"{0,-2} |"-f $_+"#"*$a[$_]}

Powershell, 97 93

$a=@{};$args-split ' '|%{$a[$_.length]++};1..($a.Keys|sort)[-1]|%{"{0,-2} |"-f $_+"#"*$a[$_]}
Source Link
Danko Durbić
  • 10.8k
  • 5
  • 28
  • 32

Powershell, 97

$a=@{};$args-split ' '|%{$a[$_.length]++};1..($a.Keys|sort -des)[0]|%{"{0,-2} |"-f $_+"#"*$a[$_]}