Write a program to keep a collection of integer numbers, perhaps with repetitions, while performing the following operations:
Input
Input consists of several operations.
Output
For every query, the current greatest number. Print also an error line for each operation (except storing) when the collection is empty.
Input
A S 10 A S -7 A S 20 A I 3 A D 15 A R A S 30 A D 37 R A R A R I 1 A R D 3 S 4 A
Output
error! 10 10 20 23 10 8 30 -7 -7 error! error! error! error! 4