Simple stack

2.3

3 votes
Easy
Problem

You have to find the deepest position of an element in the given stack of numbers.

INPUT FORMAT :
First line of input will contain an integer N, denoting the number of elements in stack.
Following N lines will contain elements E starting from bottom and ending at top.
last line will contain an integer x, whose deepest position is to be found.

OUTPUT FORMAT :
Your output should contain 1 line, printing the deepest index (1-based index) value of x

CONSTRAINTS :
1≤ N ≤102
1≤ E, x ≤108

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

It is clear that deepest value of 10 is 1 here.

Editor Image

?