You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; import java.util.stream.*;
public class Solution {
public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); // Write your code here. List<String> token = Arrays.asList(s.split("[ !,?._'@]")) .stream() .map(x -> x.trim()) .filter(x -> !x.isEmpty()) .collect(Collectors.toList()); System.out.println(token.size()); for (String t: token){ System.out.println(t); } scan.close(); }
}
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 →
import java.io.; import java.util.; import java.util.stream.*;
public class Solution {
}