Le Mercredi 10 Avril 2002 10:01, [EMAIL PROTECTED] a �crit :
> What really blows my mind (like `/anick's mythical mosquito)
> is that Jean-Pierre was *still* able to solve the problem,
> and in a tidy 126 strokes too:
>
> 126.29 Jean-Pierre Vidal Sat Apr 6 23:55:07 2002 -ln
> $h{a,sort/./g}.="$_ "}{push@t,join' ',sort split' ',$h{$_}for%h;
> / /&&print for sort{$a=~s/ / /g<=>$b=~s/ / /g||$a cmp$b}@t
Must I have to answer? for the beginners like me? well:
once filled the hash by the first 21 strokes (this was the great question),
it is easy to print it adding something like }{chop&&/ /&&print for%h
total 49 including " -ln"
now the goal is to sort the print output in less than x strokes, if possible
x <= 11 to become the winner :-)
I was unable to sort the hash itself, so I pushed all its values in an array,
pre-sorting them (40 strokes), and then sorted this array by number of
words/alphabetically with the poor 42 strokes construction
sort{$a=~s/ / /g<=>$b=~s/ / /g||$a cmp$b}@t
It is far from 45 to 126, I have to learn more. But it worked.
--
Jean-Pierre Vidal
[EMAIL PROTECTED]