https://leetcode-cn.com/problems/implement-strstr/
class Solution {
public int strStr(String haystack, String needle) {
if (needle.equals("") || needle==null||needle.equals(haystack)) {
return 0 ;
}
boolean flag=false;
for(int i=0;i<haystack.length()-needle.length()+1;i++){
flag=true;
for (int j=0;j<needle.length();j++){
if (haystack.charAt(i+j)!=needle.charAt(j)){
flag=false;
break;
}
}
if (flag){
return i;
}
}
return -1;
}
}