You are viewing a single comment's thread. Return to all comments →
Solved
public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); // Write your code here. String[] arrayTemp = s.split("[ !,?._'@]+"); StringBuffer strResult = new StringBuffer(); int count = 0; for(int i = 0; i < arrayTemp.length; i++){ if(arrayTemp[i].matches("[A-Za-z]+")){ count++; strResult.append(arrayTemp[i]+"\n"); } } System.out.println(count+"\n"+strResult); 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 →
Solved