getting this error in my code and not quite understanding how to fix trying to solve coding problems on my own to practice
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 6 at StringParenthesis.main(StringParenthesis.java:14)
public class StringParenthesis {
public static void main (String[]args){
String word = "recede";
String[] list,list2 = new String[word.length()];
list = word.toLowerCase().split("");
String result = "";
for(int i=1;i<list.length;i++) {
for(int j=1; j<list.length;i++) {
if(list[i].equalsIgnoreCase(list[j])){
list2[i] = ")";
list2[j] = ")";
}
}
}
for (int k=1; k<list2.length;k++) {
if(list2[k]!=")") {
list2[k]="(";
result +=list2[k];
}else
result +=list2[k];
}
System.out.println(result);
}
}