You are viewing a single comment's thread. Return to all comments →
much simple soln I guess:
public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s=scan.nextLine(); //Complete the code if (s.trim().length()==0 || s.trim().length()>400000) { System.out.println(0); return; } String words[]=s.trim().split("[ !,?.\\_'@]+"); System.out.println(words.length); for (String word:words) 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 →
much simple soln I guess: