What are the failed test case?

CODE: EZSPEAK

This is a program to find out whether there are 4 or more consecutive constants in the input word. t is the number of test cases. n is the word length.

After I submit, the example can be tested correctly but nit the others. So, can u think of some test case that will be failed when I run this program?

Hey @pumpin - i just took the last WA submission on your profile - this is the test case it fails on -

1
24
ocmutxqeeznsuxaksohgowih

Thanks a lot

But i need help again. I still don’t figure it out, why my problems did not work for that case? Could someone help please, thanks

Hi, @pumpin

I suspect the problem is in lines 32-33 of your code…

        for(int j=0;j<mystack.size();j++)
           {mystack.pop();}}}

You’re trying to clear the stack, right? If so, that code won’t do it. Consider a stack of size two, like mystack = { 'b', 'c' }.

Pre-loop:       Condition:                    Post-loop:
mystack    j    Is j < size()?    Action      mystack
---------  -    ---------------   ----------  ---------
{'b','c'}  0    Is 0 < 2? YES.    Pop 'b'     { 'c' }
{ 'c' }    1    Is 1 < 1? NO.     Exit loop   { 'c' }

To clear a stack, you want something more like this pseudocode…

while the stack has any elements
    pop an item off the stack
end while

But one other thing to think about: do you need to have a stack to keep track of the actual consonants? Or could you just have an integer counter that counts the number of consecutive consonants, which you then zero out if you run into a new vowel?

Good luck!
@Sbat

Fixed. :smiley: Thanks a lot