I would like to have this code be able to locate more than one X and output it as Location1, location2,.......
i.e input: xuyx i would have it output 0,3
import java.util.Scanner;
public class findinline {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String str;
str = input.nextLine();
int pos = str.indexOf("x");
if (pos < 0){
System.out.println("No X Detected");
}
else{
System.out.println(pos);
}
}
}