Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Rextester.java

//Title of this code
//'main' method must be in a class 'Rextester'.

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

public class Rextester {

    public static void main(String[] args) {
        String s = "Its always better if you find edge cases by yourself rather than buying test cases with valuable hackos!!   May be this case won't help you to find the   buuuuuug  ";//Scanner scan = new Scanner(System.in);
        //String s = scan.nextLine();
        s = s.replaceAll("[\\p{Punct}&&[^']]",""); 
        String[]tokens = s.split(" |\\'");
        System.out.println(tokens.length);
        for(int i=0;i<tokens.length;i++){
            System.out.println(tokens[i]);
        }
        //scan.close();
    }
}
 run  | edit  | history  | help 0