title: Detect that 2 string are same but in different order
body: <p>My goal is to detect that 2 string are same but in different order. </p>
  
  <pre><code>Example
  "hello world my name is foobar" is the same as "my name is foobar world hello"
  </code></pre>
  
  <p>What i already tried is splitting both string into list and compare it within loop.</p>
  
  <pre><code>text = "hello world my name is foobar"
  textSplit = text.split()
  
  pattern = "foobar is my name world hello"
  pattern = pattern.split()
  
  count = 0
  for substring in pattern:
      if substring in textSplit:
          count += 1
  
  if (count == len(pattern)):
      print ("same string detected")
  </code></pre>
  
  <p>It return what i intended, but is this actually correct and efficient way? Maybe there is another approach. Any suggestion of journal about that topic would be really nice.</p>
  
  <p>Edit 1: Duplicate words are important</p>
  
  <pre><code>text = "fish the fish the fish fish fish"
  pattern = "the fish" 
  </code></pre>
  
  <p>It must return false</p>