Moin,

On Wed, Aug 28, 2002 at 03:19:20PM +1000, [EMAIL PROTECTED] wrote:
> En op 28 augustus 2002 sprak Sec:
> > Finding (and printing) all words (from stdin) with all of a set
> > of given letters (on the command line, for simplicity) appearing
> > once in the first 10 characters of the word, and containing no
> > duplicates in the first 10 characters.
> 
> Some examples would make this specification clearer.

Uuuh. It was really late, yesterday. - I tried hard to make it clear, an
now I see that all I created was this german like moster sentence %)

- The file on stdin is a wordlist, i.e. /^[\w][-a-z]*$/
- Word has to have at least 10 characters.
- The following rules apply to only the first 10 characters:
* case is insignficant
* no duplicate letters
* each of the letters on the commandline appears once

> Does the following example match the specification?

> #!perl -n
> BEGIN{$x=pop}
> length($x)-(@z=substr($_,0,10)=~/[$x]/g)||print

nice try :)

> When I run:
[...]
> it prints:
> 
> abcdefghijklmnopqrst

Yes.

> abc

No, too short.

> abcdefxyzdabc

No, Position 4 == Position 10 [d]

CU,
    Sec
-- 
Usenet II -- because it's time for October

Reply via email to