title: String parsing using Python?
body: <p>Given a string such as 'helloyellowellow', parse all the valid strings from the given string. (Eg: [[hell,hello,yellow],[low, low]........]</p>
  
  <p>I am looking for the most optimized way to write the code. Here is mine but I am not sure if this is the best way.</p>
  
  <p>Full disclosure - This was an interview question</p>
  
  <pre><code>master = []
  
  #   Dictionary for us to look up words   
  def is_word(inputstr):
      #returns True/False
  
  
  def processstring(fstr,secstr,li):
      if is_word(fstr): 
          li.append(fstr)
      if len(secstr) == 0:
          if len(li) != 0:
              master.append(li)
          return
      processstring(fstr+secstr[0], secstr[1:len(secstr)],li)
  
  
  
  def wrapperprocess(inpstr):
      li = []
      if len(inpstr) == 0:
          return
      processstring('',inpstr,li)
      wrapperprocess(inpstr[1:len(inpstr)])
  
  
  wrapperprocess('helloyellowellow')
  print master
  </code></pre>