package com.codegym.task.task09.task0923; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; /* Vowels and consonants */ public class Solution { public static char[] vowels = new char[]{'a', 'e', 'i', 'o', 'u'}; public static void main(String[] args) throws Exception { // write your code here BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); //String s=br.readLine(); String s="sindhu,"; ArrayList<Character> cv=new ArrayList<Character>(); ArrayList<Character> cc=new ArrayList<Character>(); for(int i=0;i<s.length();i++){ char ch=s.charAt(i); if(isVowel(ch)){ cv.add(ch); } else cc.add(ch); } for(int y=0;y<cv.size();y++){ System.out.print(cv.get(y)); System.out.print(" "); } System.out.println(""); for(int x=0;x<cc.size();x++) System.out.print(cc.get(x)+" "); } // The method checks whether a letter is a vowel public static boolean isVowel(char c) { c = Character.toLowerCase(c); // Convert to lowercase for (char d : vowels) // Look for vowels in the array { if (c == d) return true; } return false; } }