You are viewing a single comment's thread. Return to all comments →
public static void main(String[] args) {
Scanner scan = new Scanner(System.in); String s = scan.nextLine(); int count = 0; String a = "[^A-Za-z]+"; s = s.trim(); String [] x = s.split(a); // System.out.println(x.length); if(s.isEmpty()){ count = 0; }else { for (String s1 : x) { count++; } } System.out.println(count); for(String s1 : x){ if(!s1.isEmpty()){ System.out.println(s1); } } // Write your code here. scan.close(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java String Tokens
You are viewing a single comment's thread. Return to all comments →
public static void main(String[] args) {