input: Write a function to search for a pattern in a given string and return the starting index of the first occurrence.
  assert pattern_search("hello", "ll") == 2
  assert pattern_search("abcdef", "def") == 3
  assert pattern_search("abcdef", "gh") == -1
output: def pattern_search(s, pattern):
      for i in range(len(s) - len(pattern) + 1):
          if s[i:i+len(pattern)] == pattern:
              return i
      return -1