You are not logged in. Please login at www.codechef.com 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

2★tyrant
1.2k202734
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 :)

link

answered 12 Aug '13, 23:13

charizard's gravatar image

4★charizard
1601110
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×1,664
×643
×38

question asked: 12 Aug '13, 22:34

question was seen: 1,336 times

last updated: 13 Aug '13, 03:29