I want to get the desired outputs like here Tests 1-4 and still prompt the user to input the tests using the Scanner scan = new Scanner(System.in). My program says out of range. How should I fix this?
public static void main(String[] args){
String word="";
System.out.println("Enter a Word:");
Scanner scan = new Scanner(System.in);
word= scan.next();
for (int j=word.length(); j>=0; j--) {
System.out.println(word.substring(j-1, j));
}
}