in reply to Golf challange: match U.S. State names
Getting here involved finding the longest unbroken string that could hold overlapping state names, adding a few more with breaks (spaces), then handling the strays with a regexp. A close inspection will show that Rhode Island is handled twice. That actually saved strokes.print /^\w\w\z/&("MNCAKSCOHINMOKTNVALARIDCTX SDE GAZ ORIL"=~/$_/| /(FL|IA|KY|M[ADEIST]|N[DEHNJY]|PA|[UV]T|W[AIVY])/) for qw(AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KT KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY)
I started down the path of looking for the shortest string that contains all of the state names (with breaks). That script is still running... So far, the solution above is shorter.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Golf challange: match U.S. State names
by dws (Chancellor) on Jun 06, 2001 at 22:13 UTC | |
Re: Re: Golf challenge: match U.S. State names
by petral (Curate) on Jun 06, 2001 at 16:21 UTC | |
by runrig (Abbot) on Jun 06, 2001 at 18:24 UTC |