fork download
  1. class Ideone {
  2. public static void main (String[] args) {
  3. String phrase = "poiuytrewq";
  4. int vowel = phrase.replaceAll("(?i)[^aeiou]", "").length();
  5. int consonant = phrase.replaceAll("(?i)[^b-z&&[^eiou]]", "").length();
  6. String reverse = new StringBuilder(phrase).reverse().toString();
  7.  
  8. System.out.println("Number of vowels: " + vowel);
  9. System.out.println("Number of consonants: " + consonant);
  10. System.out.println("Reversed: " + reverse);
  11. }
  12. }
Success #stdin #stdout 0.14s 52208KB
stdin
Standard input is empty
stdout
Number of vowels: 4
Number of consonants: 6
Reversed: qwertyuiop