Java String Tokens

  • + 1 comment

    this code is not working for test case 9 please anyone kindly help me to solve this problem

    import java.io.; import java.util.;

    public class Solution {

    public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); String[] str=s.trim().split("[\s,._;@'?!]+"); if(str.equals("")) { System.out.println("0"); } else { System.out.println(str.length); for(int i=0;i