I forgot java but... can you input the string as an array, loop through blocks of letters to find the query?
say the input block is "bobwehadababyitsaboy" (length 20)
You are searching for "had".
had = 3 length.
make the program loop through the array from 1 to 20-3.
Select 3 letters and see if those 3 match "had".
Record the positions where you get a match and your output will be "5"
Hope that helps.




Reply With Quote