I am putting 101 or 010 in the stack. first element is put simply. But before putting the second element it checks whether it is same as the first one or not.Each time if filling gets failed I empty the stack and start filling it again.this is happening simultaneously with the input. at the end if the stack is full, that is it has 3 elements, answer is GOOD else BAD! Can anyone please help me with this…
Your logic is correct just you are printing GOOD and BAD whereas in question it is mentioned that print Good and Bad. Be careful with uppercase and lowercase letters
thanks! What an idiot I am!
@aniket20 is absolutely right , you are printing GOOD instead of Good and BAD instead of Bad . Try uploading after correcting this error .