the given code is showing segmentation fault here while running but works fine in vs code and coding blocks ide
Code not getting compiled on submission
got it thanks … but wonder how it worked in vs code and coding blocks ide, that i could not find the mistake
@mahfoozhaque91 it is because of input you were running the loop for 4 times and in vs code you must be giving input according to that only.
but here in input the sample input will have 3 elements in the stack but you were trying to access the 4 elements.