You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; import java.util.regex.*; public class Solution {
public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); scan.close(); Pattern p = Pattern.compile("[A-Za-z]+"); Matcher m = p.matcher(s); List<String> tokens = new ArrayList<>(); while (m.find()) { tokens.add(m.group()); } System.out.println(tokens.size()); 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 →
import java.io.; import java.util.; import java.util.regex.*; public class Solution {
}