Write an algorithm that returns the index of the last occurrence of the value key in a sequence s1, …,sn. If key is not in the sequence, the algorithm returns 0.