need help regarding string algorithm



hello everybody i am trying to solve this problem http://acm.uva.es/p/v9/902.html
but getting TLE (time limit exceed ) becoz the input string length
could be 10^6 .
now what i did to solve this problem .
for each substring of given lengh
find all possible occurence of substring in the string .

i used KMP algroithm but still getting . i think my algorithm is
order of n^2.
plz some body suggest me how to solve this problem.
thnkx .

.



Relevant Pages

  • Re: Evaluation of C program
    ... substring and return pointer to it function and tests for it.. ... strings can be longer than an 'int' can hold. ... the 10th character in the input string. ... much faster than your search algorithm. ...
    (comp.lang.c)
  • Re: Evaluation of C program
    ... goto success; ... because the 10th character in the trial substring does not match ... the 10th character in the input string. ... much faster than your search algorithm. ...
    (comp.lang.c)
  • Re: Evaluation of C program
    ... substring and return pointer to it function and tests for it.. ... the 10th character in the input string. ... much faster than your search algorithm. ...
    (comp.lang.c)
  • Re: Evaluation of C program
    ... substring and return pointer to it function and tests for it.. ... strings can be longer than an 'int' can hold. ... the 10th character in the input string. ...
    (comp.lang.c)