帮忙解决一下?为什么会数组越界

字符串匹配的问题
public class String09 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[] str = new String[n];
for(int i =0;i< n;i++){
str[i] = sc.nextLine();
}
String s = sc.nextLine();
for(int j=0;j<n;j++){
for(int h=0;h<=str[j].length();h++){
//System.out.println("输出"+str[j].charAt(h)+"aaa"+s.charAt(h));
if(s.charAt(h)=='['|s.charAt(h)==']'){
h++;
}
if(str[j].charAt(h)==s.charAt(h)){
if(h==s.length()){
System.out.println(j +" "+str[j]);
}
}
}

    }
}

}

 h<=str[j].length
->
h<str[j].length
数组下标从0开始编号,所以范围是0-长度-1

数组的索引是从0开始到length-1结束的
例如:
int[] arr = {1,2,3};
那么索引0对应着1,1对应2,2对应3.如果你超过了,就会出现数组索引越界异常