in reply to Golf: Count unique words
Just throwing this one out there for fun and to show a different approach:
#!/usr/bin/perl -nla INIT{undef$/};$w{$_}++for@F;print"$_ ($w{$_})"for keys%w;print"".@F # 345678 1 2345678 2 2345678 3 2345678 4 2345678 5 2345678 6 234567
67 + 4 = 71 strokes
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Golf: Count unique words
by Anonymous Monk on Dec 07, 2004 at 13:10 UTC | |
by Anonymous Monk on Dec 07, 2004 at 13:13 UTC |