title: decomposing a string into known patterns
body: <p>Here's the python list of strings:</p>
  
  <p>patterns = [
  "KBKKB",
  "BBBK",
  "BKB",
  "KBBB",
  "KBB",
  "BKBB",
  "BBKB",
  "KKBKB",
  "BKBK",
  "KBKB",
  "KBKBK",
  "BBK",
  "BB",
  "BKKB",
  "BBB",
  "KBBK",
  "BKKBK",
  "KB",
  "KBKBK",
  "KKBKKB",
  "KBK",
  "BBKBK",
  "BBBB",
  "BK",
  "KKBKBK",
  "KBBKB",
  "BBKKB",
  "KKKKBB",
  "KKB"
  ]</p>
  
  <p>I have an input string that consist of K and B only of arbitrary length. I want to know all the possible complete decompositions of the input string. Just an example a string of 8 B:</p>
  
  <p>BBBBBBBB</p>
  
  <p>Here are possible decompositions</p>
  
  <p>BB BB BB BB BB</p>
  
  <p>BBBB BBBB</p>
  
  <p>BBBB BB BB</p>
  
  <p>BB BB BBBB</p>
  
  <p>BBB BBB BB</p>
  
  <p>BB BBB BBB</p>
  
  <p>Can anyone guide me how to go about it? I am not much concerned about efficiency right now.</p>