Find the Index of the First Occurrence in a String

Given two strings, return the index of the first occurrence of needle in haystack, or -1 if it does not occur. If needle is empty, return 0.

Examples
Input: ["sadbutsad","sad"]
Output: 0
Hints

Find the Index of the First Occurrence in a String

Given two strings, return the index of the first occurrence of needle in haystack, or -1 if it does not occur. If needle is empty, return 0.