You are viewing a single comment's thread. Return to all comments →
Easy Working for all test cases
Scanner sc = new Scanner(System.in); String sent=sc.nextLine().trim(); if(sent.length()>0){ String [] words = sent.split("[ !,?._'@]+"); System.out.println(words.length); for (String word:words) System.out.println(word); }else{ System.out.println(0); } sc.close();
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Java String Tokens
You are viewing a single comment's thread. Return to all comments →
Easy Working for all test cases