You are viewing a single comment's thread. Return to all comments →
// worked
import java.util.Arrays; import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in); String s = in.nextLine(); String[] tokens = s.split("[ !,?._'@]+"); tokens = Arrays.stream(tokens).filter(token -> !token.isBlank()).toArray(String[]::new); System.out.println(tokens.length); for (String token : tokens) System.out.println(token);
} }
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 →
// worked
import java.util.Arrays; import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
} }