You are not logged in. Please login at to post your questions!


Interesting substring matching problem

Given a set of words: S = {"the", "to", "presentation"}
And a text T = "textmayrefertotherepresentationofwrittenlanguage"
Find the index of matching in text T from all words of S (one of permutations of S). It guarantees that the substring occurs exactly once in text.
Any idea how to solve this problem? (without bruteforce :()

asked 12 Aug '13, 22:34

tyrant's gravatar image

accept rate: 12%

edited 12 Aug '13, 22:34

try Finite State Automata...not sure if it will work...!!!

(12 Aug '13, 22:44) kunal3614★

can u post a link to the problem page?

(13 Aug '13, 03:29) bondoc734★

This may help.. Found this Aho-Corasick implementaion on github :)


answered 12 Aug '13, 23:13

charizard's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 12 Aug '13, 22:34

question was seen: 1,336 times

last updated: 13 Aug '13, 03:29