We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- Strings
- Java String Tokens
- Discussions
Java String Tokens
Java String Tokens
Sort by
recency
|
1740 Discussions
|
Please Login in order to post a comment
import java.io.; import java.util.; import java.util.stream.*;
public class Solution {
}
import java.io.; import java.util.;
public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s=sc.nextLine(); String[] tokens=s.split("[^a-zA-Z]+"); int count=0; for(String token:tokens){ if(!token.isEmpty()){ count++; } } System.out.println(count); for(String token:tokens){ if(!token.isEmpty()){ System.out.println(token); } } } }
public static void main(String[] args) {
import java.io.; import java.util.;
public class Solution {
}