fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.util.regex.Pattern;
  4. import java.util.regex.Matcher;
  5.  
  6. class Main
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. int scount = 0;
  11. Pattern p2 = Pattern.compile("\\w{1,2}");
  12. String txt = "hello everyone this is just test aa ";
  13. Matcher m2 = p2.matcher(txt);
  14. while (m2.find()) {
  15. scount++;
  16. }
  17. System.out.println(scount);
  18. }
  19. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
15