in reply to Collapsing a string to unique characters
Golf:55 (and no sort!)
perl -ple"local($\",@_);@_[unpack'C*',$_]=split'';$_=qq[@_]" test-stri +ngs +/034589BDFHKMNUXabcfghjlnqstuwxyz /1234589ACEGIKLMNPQRSTbdefhjklnopqstux /013589ABCIMNRTVYbcdefghjkloqtuwxy /03589BEFKLMNOPQTabcfghlmqrtuvwx +/1345689ACGKMNOQWbdghlmnoqrtuwx /234589ABDEFGHIMNORTabdfhilnqtuwxyz +/01345789ACEIMNPQTZabcefghlmqtuwx /234589ACGILMNOQUbehlmoqrstuwxyz
Unix version is one less:perl -ple'local($",@_);@_[unpack"C*",$_]=split"";$_=qq[@_]'
Two less(thanks ikegami):perl -ple'local($",@_);@_[unpack"C*",$_]=split"";$_="@_"'
Update:54: perl -ple"local(@_);@_[unpack'C*',$_]=split'';$_=join'',@_" test-strings
50: -ple"@_=();@_[unpack'C*',$_]=split'';$_=join'',@_"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Collapsing a string to unique characters
by ikegami (Patriarch) on Jan 09, 2009 at 14:49 UTC | |
by Corion (Patriarch) on Jan 09, 2009 at 14:55 UTC | |
by BrowserUk (Patriarch) on Jan 09, 2009 at 15:10 UTC | |
by JavaFan (Canon) on Jan 09, 2009 at 15:04 UTC | |
|
Re^2: Collapsing a string to unique characters
by dwhite20899 (Friar) on Jan 09, 2009 at 14:32 UTC |