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(); String[] strArray = s.split("[ !,?._'@]"); strArray = Arrays.stream(strArray) .filter(str -> !str.isEmpty()) .toArray(String[]::new); System.out.println(strArray.length); Arrays.stream(strArray).forEach(e->System.out.println(e)); scan.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 →