package main import ( "strings" "fmt" "math" ) // search needle in haystack func strStr(haystack string, needle string) int { for i := 0; i <= len(haystack) - len(needle); i++ { j := 0 for ; j < len(needle); j++ { if haystack[i + j] != needle[j] { break } } if j == len(needle) { return i } } return -1 }