fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  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 d = "hello";
  13.  
  14. for(char c : d.toCharArray()) {
  15. if(isVowel(c)) {
  16. d = replaceVowel(d, c);
  17. }
  18. }
  19. System.out.println(d);
  20. }
  21.  
  22. private static boolean isVowel(char c) {
  23. return "AEIOUaeiou".indexOf(c) != -1;
  24. }
  25.  
  26. private static String replaceVowel(String original, char c) {
  27. String vowel = Character.toString(c);
  28. return original.replace(vowel, String.format("%1$sf%1$s",vowel));
  29. }
  30. }
Success #stdin #stdout 0.08s 381184KB
stdin
Standard input is empty
stdout
hefellofo