fork(4) download
  1. /* Find first vowel in a word after the first character and then normalize it.*/
  2. // Garis Suero
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.Pattern;
  7. import java.util.regex.Matcher;
  8. import java.text.Normalizer;
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. class Ideone
  12. {
  13. public static void main (String[] args) throws java.lang.Exception
  14. {
  15. Pattern pattern = Pattern.compile("[\\w]([aeiouâãäåæçèéêëìíîïðñòóôõøùúûü])", Pattern.CASE_INSENSITIVE);
  16. Matcher matcher = pattern.matcher("Alvarez");
  17. if (matcher.find()) {
  18. System.out.println(unAccent(matcher.group(1)));
  19. }
  20. }
  21.  
  22. public static String unAccent(String s) {
  23. String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
  24. Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
  25. return pattern.matcher(temp).replaceAll("");
  26. }
  27. }
Success #stdin #stdout 0.08s 381248KB
stdin
Standard input is empty
stdout
a