fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.*;
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String frase = "Buenos días, murciélago. ¿Qué tal? aeiou!";
  13.  
  14. System.out.println(comprobar(frase));
  15. }
  16.  
  17.  
  18. public static ArrayList<String> comprobar (String frase){
  19.  
  20. String [] palabras = frase.split(" ");
  21. ArrayList<String> out = new ArrayList<String>();
  22. Pattern pat = Pattern.compile("[aeiouáéíóúü]", Pattern.CASE_INSENSITIVE);
  23.  
  24. for (String palabra : palabras) {
  25.  
  26. Matcher m = pat.matcher(palabra);
  27. Set<String> vocales = new HashSet<String>();
  28. while (m.find()) {
  29.  
  30. vocales.add(m.group(0));
  31.  
  32. }
  33. if(vocales.size() >=4){
  34.  
  35. out.add(palabra.replaceAll("[,.:!;()]", ""));//quitar signos de puntuacion
  36. }
  37. }
  38. return out;
  39.  
  40. }
  41. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
[murciélago, aeiou]