Well ... it's pretty obvious why.
And since the code you show doesn't compile I have to start having doubts how much you have done for yourself ... In Java,
string
is not the same as
String
so this line doesn't compile:
Stack<string> stack = new Stack();
Fix that, and then look at your loop.
Where do you decide that a character is a vowel or a consonant?
Where are the two stracks you need to store them separately?
What do you do with
ch
inside the loop?
It looks to me as if you have thrown that together in the hope it might work, and failing that someone might write the correct code for you. That's not going to happen. We can't do all the work, it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
If you are having problems getting started at all, then this may help:
How to Write Code to Solve a Problem, A Beginner's Guide[
^]