text: Stack to store elements and the count of the numbers they popped First part of pair is value of inserted element Second part is count of the number of elements pushed before with a greater value
code: Stack < pair > q = new Stack < pair > ( ) ;