I have this pretty much figured out, my only question: how do i remove the errant space between the two "m"'s in my output. everything else works great(now) jsut not sure how to do that.
package com.codegym.task.task09.task0923;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
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 reader = new BufferedReader(new InputStreamReader(System.in));
char[] input = reader.readLine().toCharArray();
ArrayList<String> vlist = new ArrayList<>();
ArrayList<String> other = new ArrayList<>();
for (int i=0; i<input.length; i++) {
if (isVowel(input[i])){
vlist.add(String.valueOf(input[i]));}
else {other.add(String.valueOf(input[i]));}
}
for (int j=0; j<vlist.size(); j++){
System.out.print(vlist.get(j)+" ");
}
System.out.println();
for (int k=0; k<other.size(); k++){
System.out.print(other.get(k)+" ");
}
}
// 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;
}
}