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(); // Write your code here.
String ss = s.trim(); String [] ourwords=ss.split("[ !,?._'@]+"); int num=ourwords.length; if(ss.equals("")){ num=0; } System.out.println(num); for (String word : ourwords){ System.out.println(word); }
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) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); // Write your code here.