|No such thing as a small change|
Re: longest common substring (with needed tweaks)by Lennotoecom (Pilgrim)
|on Oct 27, 2013 at 17:27 UTC||Need Help??|
output will be
which is the longest common substring in this case so about your options, change 3 to 2 in the last cycle
and you'll get the common substring for at least to lines.
I know this is ugly. No time)
the algorithm of the monstrosity above:
1. taking first line.
2. create all possible combinations of substrings out of it and put it into hash.
3. in the cycle take each line, and create all possible substrings out of it creating temporal hash.
4. compare temp. hash with the first, increment only those which are in both.
5. at the last cycle the number in the if construction, sorts how many lines have to have desirable longest substring.