fork(1) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Main
  7. {
  8. private static final Pattern VOWELS = Pattern.compile("(?:(a)|(e)|(i)|(o)|(u)|.)+", Pattern.CASE_INSENSITIVE);
  9.  
  10. public static boolean allVowelsThere(String input) {
  11. Matcher m = VOWELS.matcher(input);
  12. return m.matches() &&
  13. m.group(1) != null &&
  14. m.group(2) != null &&
  15. m.group(3) != null &&
  16. m.group(4) != null &&
  17. m.group(5) != null;
  18. }
  19.  
  20. public static void main (String[] args) throws java.lang.Exception
  21. {
  22.  
  23. String[] cases = {
  24. "ABCDE",
  25. "AEIOU",
  26. "UOIEA",
  27. "XaeiouT",
  28. "XaeKou",
  29. "Hello, how are you keeping?"
  30. };
  31.  
  32. for (String input : cases) {
  33. System.out.println(allVowelsThere(input) + " -> " + input);
  34. }
  35.  
  36. }
  37. }
Success #stdin #stdout 0.1s 320256KB
stdin
Standard input is empty
stdout
false -> ABCDE
true -> AEIOU
true -> UOIEA
true -> XaeiouT
false -> XaeKou
true -> Hello, how are you keeping?