|Perl Monk, Perl Meditation|
Re: Re: Pattern Findingby tachyon (Chancellor)
|on Sep 24, 2001 at 21:12 UTC||Need Help??|
Have you considered what your 'rules' imply:
3. There could be multiple answers.
Every single char is by definition a pattern. So to is every combination of substrings. There will be quite a few answers. The number will be given by:
l + (l-1) + (l-2) + ..... ( l - (l - 1) ) + ( l - l ) where l = length of the string.
This is (l+(l**2))/2 for each and every string under your rules. BTW my substring/dictionary and best match hack returns this:
Your rules are not specific enough to formulate an answer. How do you define what is part of a pattern. Is this "Igohellohellohellohi" a string that contains 3 'hello' or 4 'hi' or 6 'l'..... Perhaps concluding this was the real task?