You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; /* *@Author : Rehan *Using Stream API in Java8 */ public class SolutionDump {
public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); scan.close(); if (s.trim().length()==0 || s.trim().length()>400000){ System.out.println(0); return; } s=s.trim(); // Write your code here. List<String> count = Stream .of(s.split("[^(a-zA-Z)]+")).collect(Collectors.toList()); System.out.println(count.size()); //to print the expected list \Stream.of(s.split("[^(a-zA-Z)]+")).forEach(System.out::println); }
}
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.; /* *@Author : Rehan *Using Stream API in Java8 */ public class SolutionDump {
}