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 str ="cOolEesAaiI";
  13. String v ="AEIOUaeiou";
  14. String newStr ="";
  15. char [] vowels = v.toCharArray();
  16. int index = 0;
  17. int i = 0;
  18.  
  19. for (index =0; index < str.length(); index++){
  20. for (int j = 0; j < vowels.length; j++){
  21. if(str.charAt(index) == vowels[j]){
  22. System.out.println(str.charAt(index));
  23. newStr = str.substring(0,index) + str.substring(index+1);
  24. str= newStr;
  25. index --;
  26. j--;
  27. System.out.println("new string: " + newStr);
  28. break;
  29. }
  30. }
  31.  
  32. }
  33.  
  34. char [] strArr = str.toCharArray();
  35. System.out.println(" string: " + str);
  36. int left = 0;
  37. int right = str.length() - 1;
  38. char temp;
  39. while (left < right){
  40. temp = strArr[left];
  41. strArr[left] = strArr[right];
  42. strArr[right] = temp;
  43. left++; right--;
  44. }
  45. int x = 0;
  46. String finalStr ="";
  47. while (x < strArr.length){
  48. finalStr = finalStr + strArr[x];
  49. x++;
  50.  
  51. }
  52. System.out.println("final string: " + finalStr);
  53. }
  54. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
O
new string: colEesAaiI
o
new string: clEesAaiI
E
new string: clesAaiI
e
new string: clsAaiI
A
new string: clsaiI
a
new string: clsiI
i
new string: clsI
I
new string: cls
 string: cls
final string: slc