I am trying to terminate my code when "END" is input into the console, however my code wont play fair and I can't seem to see where it is going wrong, btw I haven't learnt how to debug as of yet so this has largely got to do with why i can't figure it out. please do help if you can.
import java.util.*;
class Main 
{
public static void main(String args[])
{
    int j = 0;
    while (j++ <= 3) {    
        // Create Scanner object to take input from command prompt
        Scanner s=new Scanner(System.in); 
        // Take input from the user and store it in st
        String st = "";
        while (!st.equals("END")) {
            {
                st=s.nextLine();
                // Initialize the variable count to 0
                int count=0;
                // Convert String st to char array
                char[] c=st.toCharArray();
                // Loop till end of string
                for(int i=0;i<st.length();i++)
                // If character at index 'i' is not a space, then increment count
                    if(c[i]!=' ') count++;
                // Print no.of spaces
                System.out.printf("[%4d] spaces in ", +(st.length()-count));
                // Print no.of spaces
                System.out.println('"' + st + '"');
            }
            j++;
        }
    }
}
 
     
     
    